all Python 3mathterm
math.asin
trigonometry
The arc sine of a value. It takes a value in [-1, 1] and returns an angle in radians in [-π/2, π/2].
Syntax
math.asin(x)
Same domain trap: an argument outside [-1, 1], even by 1e-16 of rounding error, raises ValueError: math domain error, so clamp computed values before passing them in. Do not use asin to recover the angle of a point either — its result is confined to [-π/2, π/2] and loses the quadrant; math.atan2(y, x) uses the signs of both arguments and handles x equal to zero.
Examples
import math
print(math.asin(0)) # → 0.0
print(math.asin(1)) # → 1.5707... (π/2)
print(math.asin(-1)) # → -1.5707...
print(math.asin(0.5)) # → 0.5235... (π/6)
print(math.degrees(math.asin(0.5))) # → ? (значение зависит от системной libm — карточка учит наличию погрешности, а не её цифрам)
print(round(math.asin(math.sqrt(2)/2),4)) # → 0.7854 (π/4)
See also
Open in the full glossarydocs.python.orgReport an inaccuracy