Visit Mozilla.org

Core JavaScript 1.5 Reference:Global Objects:Math:asin

From MDC


Contents

[edit] Summary

Returns the arcsine (in radians) of a number.

Method of Math

Static

Implemented in: JavaScript 1.0, NES 2.0
ECMA Version: ECMA-262

[edit] Syntax

Math.asin(x)

[edit] Parameters

x 
A number.

[edit] Description

The asin method returns a numeric value between -pi/2 and pi/2 radians for x between -1 and 1. If the value of number is outside this range, it returns NaN.

asin is a static method of Math, so you always use it as Math.asin(), rather than as a method of a Math object you created.

[edit] Examples

[edit] Example: Using Math.asin

The following function returns the arcsine of the variable x:

function getAsin(x) {
   return Math.asin(x)
}

If you pass getAsin the value 1, it returns 1.570796326794897 (pi/2); if you pass it the value 2, it returns NaN because 2 is out of range.

[edit] See Also

acos, atan, atan2, cos, sin, tan