math.asin(x) returns the arc sine (inverse sine) of x in radians, within the principal range [-pi / 2, pi / 2].
Inputs must lie in [-1, 1]; any value outside that interval raises ValueError. Wrap the result with math.degrees() if you need degrees.
math.asin() is a function in Python's standard math module: import it with import math and call math.asin(...), or import the name directly with from math import asin.
Syntax
Import math and pass a ratio in [-1, 1].
python
import math
angle_rad = math.asin(ratio)
Call
What it does
math.asin(0)
Returns 0.0.
math.asin(0.5)
Returns approximately 0.523598... (pi / 6).
math.asin(-1.0)
Returns approximately -1.570796... (-pi / 2).
math.asin(1.1)
Raises ValueError: outside [-1, 1].
When computing ratios like y / hypot(x, y), tiny rounding drift can push 1.0 to 1.0000000000000002; clamp with max(-1.0, min(1.0, r)) before calling asin().
Function signatures
python
math.asin(x, /)
# returns: float arc sine in [-pi/2, pi/2] for -1 <= x <= 1
Parameters
Parameter
Description
x
Required positional number (int or float) between -1 and 1 inclusive.
Return Value
Return Value
Description
float
Angle in radians inside [-pi / 2, pi / 2]; returns nan for nan.
Python Examples
Example 1 — Find Wheelchair Ramp Angles From Rise and Length
Convert vertical rise divided by ramp length into degrees with math.degrees(math.asin(...)).
python
import math
for rise, length in [(0.0, 5.0), (1.0, 12.0), (1.0, 2.0), (4.0, 4.0)]:
angle_deg = math.degrees(math.asin(rise / length))
print(f"rise={rise} len={length} -> {angle_deg:.2f} deg")