atan

Returns the arctangent (in radians) of a number.

Applies to

Math

Syntax

atan(x)

Parameters

x

A number.

Description

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

atan is a static method of Math. As a result, you always use it as Math.atan(), rather than as a method of a Math object you create.

Example

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.

See also

Math.acos, Math.asin, Math.atan2, Math.cos, Math.sin, Math.tan