Visit Mozilla.org

Core JavaScript 1.5 Reference:Global Objects:Math:atan

From MDC


Contents

[edit] Summary

Returns the arctangent (in radians) of a number.

Method of Math

Static

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

[edit] Syntax

Math.atan(x)

[edit] Parameters

x 
A number.

[edit] Description

The atan method returns a numeric value between -pi/2 and pi/2 radians.

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

[edit] Examples

[edit] Example: Using Math.atan

The following function returns the arctangent of the variable x:

function getAtan(x) {
   return Math.atan(x)
}

If you pass getAtan the value 1, it returns 0.7853981633974483; if you pass it the value .5, it returns 0.4636476090008061.

[edit] See Also

acos, asin, atan2, cos, sin, tan