Math.atan() Method - Math Functions

Math.atan() method of Math Functions in Javascript.
How to get the arctangent value of a number in javascript?

Explanation

Object: Math
Method: Math.atan()
Description: To get the arctangent value for a number using Math Functions. This function returns the value in the range of -PI/2 and PI/2 radians.

Example:


<script type="text/javascript">
document.write('Arctangent of 2 is::'+Math.atan(2));
document.write('</br>');
document.write('Arctangent of 0 is::'+Math.atan(0));
document.write('</br>');
document.write('Arctangent of -1 is::'+Math.atan(-1));
</script>

Result:




In the above example,
  • Math.atan() function returns value for 2 is 1.107148 radians, but for 0 it is 0.
  • The atan value returned for the number -1 is -0.78539.

Ask Questions

Ask Question