Trigonometry

Common trigonometry functions

Functions

acos(x) → {number}

The acos() method returns the arccosine of a number as a value between 0 and PI radians.

Parameters:
Name Type Description
x number

Required. If the parameter x is outside the range -1 to 1, the method will return NaN

Returns:
Type:
number

A Number, from 0 to PI, or NaN if the value is outside the range of -1 to 1

Example
acos(0.5)

asin(x) → {number}

The asin() method returns the arcsine of a number as a value between -PI/2 and PI/2 radians.

Parameters:
Name Type Description
x number

Required. If the parameter x is outside the range -1 to 1, the method will return NaN

Returns:
Type:
number

A Number, from -PI/2 to PI/2, or NaN if the value is outside the range of -1 to 1

Example
asin(0.5)

atan(x) → {number}

The atan() method returns the arctangent of a number as a value between -PI/2 and PI/2 radians.

Parameters:
Name Type Description
x number

Required. A number

Returns:
Type:
number

A Number, from PI to -PI, or NaN if the value(s) are empty

Example
atan(2)

atan2(y, x) → {number}

The atan2() method returns the arctangent of the quotient of its arguments, as a numeric value between PI and -PI radians. The number returned represents the counter clockwise angle in radians (not degrees) between the positive X axis and the point (x, y).

Parameters:
Name Type Description
y number

Required. A number representing the y coordinate

x number

Required. A number representing the x coordinate

Returns:
Type:
number

A Number, from -PI/2 to PI/2, or NaN if the value is empty

Example
atan(8, 4)

cos(x) → {number}

The cos() method returns the cosine of a number.

Parameters:
Name Type Description
x number

Required. A number

Returns:
Type:
number

A Number, from -1 to 1, representing the cosine of an angle, or NaN if the value is empty

Example
cos(3)

degrees(x) → {number}

The degrees functions converts an angle measured in radians to degrees

Parameters:
Name Type Description
x number

Required. An angle in radians

Returns:
Type:
number

A Number, the angle in degrees

Example
degrees(3.14)

radians(x) → {number}

The radians functions converts an angle measured in degrees to radians

Parameters:
Name Type Description
x number

Required. An angle in degrees

Returns:
Type:
number

A Number, the angle in radians

Example
radians(45)

sin(x) → {number}

The sin() method returns the sine of a number.

Parameters:
Name Type Description
x number

Required. A number

Returns:
Type:
number

A Number, from -1 to 1, representing the sine of an angle, or NaN if the value is empty

Example
sin(3)

tan(x) → {number}

The tan() method returns a number that represents the tangent of a number.

Parameters:
Name Type Description
x number

Required. A number, in radians, to find the tangent of

Returns:
Type:
number

A Number, representing the tangent of a number

Example
tan(1)