math.asin
Defined in module
"math"from "math" import asinReturns the arcsine of x
Parameters
x | number | value whose arcsine is wanted |
Return value
The arcsine of x, in the range [-PI/2, PI/2], always as a float.
Notes
The mathematical arcsine is only defined for x in [-1, 1]; C's asin answers a domain error with nan outside it. Quirrel avoids that: x is clamped to [-1, 1] before the call, so asin(2) quietly returns the same value as asin(1) instead of nan.
Example
from "math" import asin
println("asin(0) =", asin(0))
println("asin(0.5) =", asin(0.5))
println("asin(1) =", asin(1))
// out of [-1, 1], the argument is clamped instead of returning nan
println("asin(2) == asin(1) =", asin(2) == asin(1))
println("asin(-2) == asin(-1) =", asin(-2) == asin(-1))Output:
asin(0) = 0
asin(0.5) = 0.523599
asin(1) = 1.5708
asin(2) == asin(1) = true
asin(-2) == asin(-1) = trueSee also
acos | Returns the arccosine of x |
atan | Returns the arctangent of x |
sin | Returns the sine of x (in radians) |
PI | The ratio of a circle's circumference to its diameter, for converting between radians and degrees and for angle math in general. |
| math | module index |