This commit is contained in:
markjreed 2024-04-17 11:32:43 +02:00 committed by GitHub
commit 3850eae254
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