docs of new floats routines and added them to VM target too

This commit is contained in:
Irmen de Jong 2024-04-17 20:03:36 +02:00
parent 07710e0995
commit 5ac9c75521
2 changed files with 27 additions and 0 deletions

View File

@ -80,6 +80,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 {
%ir {{
loadm.f fr0,floats.ln.value

View File

@ -382,12 +382,22 @@ point variables. This includes ``print_f``, the routine used to print floating
``atan (x)``
Arctangent.
``atan2 (y, x)``
Two-argument arctangent that returns an angle in the correct quadrant
for the signs of x and y, normalized to the range [0, 2π]
``ceil (x)``
Rounds the floating point up to an integer towards positive infinity.
``cos (x)``
Cosine.
``cot (x)``
Cotangent: 1/tan(x)
``csc (x)``
Cosecant: 1/sin(x)
``deg (x)``
Radians to degrees.
@ -426,6 +436,9 @@ point variables. This includes ``print_f``, the routine used to print floating
``sin (x)``
Sine.
``secant (x)``
Secant: 1/cos(x)
``tan (x)``
Tangent.