Home >>Java Math Methods >Java Math.atan() method

Java Math.atan() method

Java Math.atan() method

Java Math.atan() Method is used to measure the angle tangent of the trigonometric Arc. Often called Arc Tangent as an inverse of a tangent. This way the values between -pi/2 and pi/2 are recovered.

Syntax

public static double atan(double a)

Parameters

a = This parameter is used to specify the value whose arc tangent is to be returned.

Returns

It is used to returns the arc tangent of the argument.

  1. This approach returns the Arc Tangent value if the statement is positive or negative number.
  2. This method returns -1 if the statement is -1.
  3. If Zero is the argument, the procedure returns Zero with the same sign as the argument.

Java Math.atan() Method Example 1


public class MyClass
{  
    public static void main(String[] args)   
    {  
        double a = 3.237;  
        System.out.println(Math.atan(a));  
    }  
}  

Output:
1.2711689479543642

Java Math.atan() Method Example 2


public class MyClass 
{  
    public static void main(String[] args)   
    {  
        double x = -2.0;  
        System.out.println(Math.atan(x));  
    }  
} 

Output:
-1.1071487177940904