Primitive Data Types Tutorial
Trigonometric Functions
Usual trigonometric functions are available:
sin(x),
cos(x),
tan(x),
asin(x),
acos(x) and
atan(x).
The type of each of these functions is ( Float -> Float ).
Angles are measured in radians.
Additionally, atan2(x,y) maps a pair of float values
to appropriate angle. For non-zero values, atan2(x,y) = atan(x/y).
Source code:
{#
sin(3.14/2.0) * cos(3.14/2.0),
tan(3.14/2.0),
asin(0.5) + acos(0.5),
atan(0.5),
atan2(1.0,2.0),
atan2(1.0,0.0)
#}
Result:
{# 0.000796, 1255.660278, 1.570796, 0.463648, 0.463648, 1.570796 #}
|