acos Function

Top  Previous  Next

Returns the arccosine of a number as a value value between 0 and PI radians.

Syntax

Math.acos(number)

Arguments

numberA number.        

Return Value

A number, from 0 to PI, if the argument is within the range -1 to 1; otherwise, NaN.

Examples

Math.acos(1);      // Returns 0

Math.acos(0.5);    // Returns 1.047198

Math.acos(0);      // Returns 1.570796

Math.acos(-0.5);   // Returns 2.094395

Math.acos(-1);     // Returns 3.141593

See also

Math.asin