mirror of
https://github.com/irmen/prog8.git
synced 2024-12-24 01:29:28 +00:00
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:
parent
d6a67f5f2b
commit
07710e0995
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user