Reference · Math

math.asin

signature
math.asin(num) -> float

What it does

The arc sine: the angle in radians, between -pi/2 and pi/2, whose sine is the number, as Python's math.asin. The number must be between -1 and 1. The angle in degrees comes from math.degrees.

Examples

print(math.asin(0), math.asin(1), math.asin(-1))print(math.asin(0.5), math.degrees(math.asin(0.5)))
output
0.0 1.5707963267948966 -1.57079632679489660.5235987755982989 30.000000000000004

Edge cases

print(math.degrees(math.asin(0.5)), round(math.degrees(math.asin(0.5)), 10))let c = 1.0000000000000002print(math.asin(min([1, max([-1, c])])))print(math.asin(math.sin(1)), math.asin(math.sin(3)))print(math.asin(math.nan))
output
30.000000000000004 30.01.57079632679489661.0 0.14159265358979323NaN

Errors

A number outside -1..1, infinity included, is a runtime error (a domain error), not an error value: it stops the request, and ?? does not catch it. A value that is not a number is a runtime error too.

this one fails
print(math.asin(2))
output
line 1: `math.asin`: math domain error (2)
this one fails
print(math.asin(1.0000000000000002))
output
line 1: `math.asin`: math domain error (1.0000000000000002)

Chaining

print(0.5 | math.asin | math.degrees | round(6))print([0, 0.5, 1] | map(math.asin))
output
30.0[0.0, 0.5235987755982989, 1.5707963267948966]

See also

math.sin, math.acos, math.atan, math.atan2, math.degrees

Thread
8Useful? Like it, or add to its thread below.

Thread 0 posts

On math.asin(): questions, tips, corrections, and code that uses it.

No posts yet. The first one opens the thread.

    Edit this page on GitHub · every example's output was made by running it (tools/refcheck.mjs) · questions on Discord or r/quillo