Java Math atan() Method
Example
Return the arc tangent of different numbers:
System.out.println(Math.atan(0.5));
System.out.println(Math.atan(-0.5));
System.out.println(Math.atan(5));
System.out.println(Math.atan(-5));
System.out.println(Math.atan(100));
System.out.println(Math.atan(-100));
Definition and Usage
The atan()
method returns the arc tangent of a number in radians.
Tip: The atan()
method only returns angles between -PI/2 and PI/2. The atan2() method can return any angle.
Syntax
public static double atan(double number)
Parameter Values
Parameter | Description |
---|---|
number | Required. A number to find the arc tangent of. |
Technical Details
Returns: | A double value representing the arc tangent of a number in radians. |
---|---|
Java version: | Any |
❮ Math Methods