atan()  Math  class methodS2C Home  « Globals « Math « atan()

Description

Returns the arctangent of a number in radians between -PI/2 and PI/2.

  • Radians to Degrees - divide number by (Math.PI / 180).
  • Degrees to Radians - multiply number by (Math.PI * 180).
  • Like all class methods atan() should be used on the class rather than an instance of the class.

Syntax

Signature Description
Math.atan(value)Returns the absolute value of a number.

Parameters

Parameter Description
valueThe value you wish to find the arctangent in radians for:
  • Invalid values or no value passed return NaN.

Examples

The code below displays atan() usage.


/*
 * Store results in an array.
 */ 
var atanValues = new Array(6);
atanValues[0] = Math.atan(-1);
atanValues[1] = Math.atan(0);
atanValues[2] = Math.atan(0.75);
atanValues[3] = Math.atan(-2);
atanValues[4] = Math.atan('a string');
atanValues[5] = Math.atan();
alert(atanValues);  

Press the button below to action the above code:


Related Tutorials

JavaScript Advanced Tutorials - Lesson 4 - Math

go to home page Homepage go to top of page Top