Python math.asin() Method

Python math 模块Python math Module

Python math.asin(x)Returns the arc sine of x, with the result in the range -pi/2 to pi/2.

math.asin() accepts parameters from -1 to 1.

Python version: 1.4

Syntax

The syntax of the math.asin() method is as follows:

math.asin(x)

Parameter description:

  • x-- Required, a number between -1 and 1. If x is not a number, a TypeError is returned.

Return Value

Returns a float representing the arc sine of a number.

Example

The following example returns the arc sine of different numbers:

Example

# Import the math package
import math

# Output the arc sine value
print(math.asin(0.55))
print(math.asin(-0.55))
print(math.asin(0))
print(math.asin(1))
print(math.asin(-1))

Output result:

0.5823642378687435
-0.5823642378687435
0.0
1.5707963267948966
-1.5707963267948966

Python math 模块Python math Module

Other Extensions