Feature/reciprocal tangent functions (#133)

* feat: additional trig functions

* fix: 64tass won't assemble a proc named 'sec'

* fix: indentation
This commit is contained in:
markjreed 2024-04-17 13:54:47 -04:00 committed by GitHub
parent d6a67f5f2b
commit 07710e0995
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -93,6 +93,20 @@ sub atan(float value) -> float {
}}
}
; two-argument arctangent that returns an angle in the correct quadrant
; for the signs of x and y, normalized to the range [0, 2π]
sub atan2(float y, float x) -> float {
float atn = atan(y / x)
if x < 0 atn += π
if atn < 0 atn += 2*π
return atn
}
; reciprocal functions
sub secant(float value) -> float { return 1.0 / cos(value) }
sub csc(float value) -> float { return 1.0 / sin(value) }
sub cot(float value) -> float { return 1.0 / tan(value) }
sub ln(float value) -> float {
%asm {{
lda #<value