Thursday, September 18, 2025
HomeLanguagesJavascriptJavaScript Math atan() Method

JavaScript Math atan() Method

Javascript Math.atan( ) method is used to return the arctangent of a number in radians. The Math.atan() method returns a numeric value between -pi/2 and pi/2 radians. The atan() is a static method of Math, therefore, it is always used as Math.atan(), rather than as a method of a Math object created.

Math.atan(x)=arctan(x)=unique y where y belongs to [-pi/2;pi/2] such that tan(y)=x

Syntax:

Math.atan(value)

Parameters: This function accepts a single parameter as mentioned above and described below:

  • x: which is a number in radians whose arctangent you want to find.

Returns: The Math.atan() function returns the arctangent of the given number in radians. The below examples illustrate the Math atan( ) method in JavaScript

Below is an example of the Math atan( ) Method.

Example 1: This example returns the atan value when 1 is passed as a parameter.

javascript




console.log("When 1 is passed as a parameter: "
    + Math.atan(1));


Output

When 1 is passed as a parameter: 0.7853981633974483

Example 2: This example returns the atan value when 0 is passed as a parameter.

javascript




console.log("When 0 is passed as a parameter: "
    + Math.atan(0));


Output

When 0 is passed as a parameter: 0

Example 3: This example returns the atan value when -0 is passed as a parameter.

javascript




console.log("When -0 is passed as a parameter: "
    + Math.atan(-0));


Output

When -0 is passed as a parameter: 0

Example 4: This example returns the atan value when infinity is passed as a parameter.

javascript




console.log("When Infinity is passed as a parameter: "
    + Math.atan(Infinity));


Output

When Infinity is passed as a parameter: 1.5707963267948966

Example 5: This example returns the atan value when -infinity is passed as a parameter.

javascript




console.log("When -Infinity is passed as a parameter: "
    + Math.atan(-Infinity));


Output

When -Infinity is passed as a parameter: -1.5707963267948966

We have a complete list of Javascript Math Objects methods, to check those please go through this Javascript Math Object Complete reference article.

Supported Browsers:

  • Google Chrome 1 and above
  • Firefox 1 and above
  • Opera 3 and above
  • Safari 1 and above
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32299 POSTS0 COMMENTS
Milvus
84 POSTS0 COMMENTS
Nango Kala
6660 POSTS0 COMMENTS
Nicole Veronica
11834 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11895 POSTS0 COMMENTS
Shaida Kate Naidoo
6779 POSTS0 COMMENTS
Ted Musemwa
7052 POSTS0 COMMENTS
Thapelo Manthata
6735 POSTS0 COMMENTS
Umr Jansen
6741 POSTS0 COMMENTS