StrictMath atan() Method in Java
The java.lang.StrictMath.atan() is an inbuilt method of StrictMath class which is used to return the tangent of a given argument. It returns the angle is within the range of -pi/2 and pi/2. It gives rise to two special results:
- The output is NaN if the passed parameter is a NaN.
- If the passed argument is 0, then the result is also a 0 retaining the same sign as the argument.
Syntax :
public static double atan(double num)
Parameters: The method accepts one parameter num of double type and refers to the value whose tangent is to be returned.
Return Value: The method returns the arc tangent value of the argument.
Examples :
Input: num = 0.61 Output: 0.5477400137159024 Input: num = 0.0 Output: 0.0 Input: num = -71.0 Output: -1.5567127509720364
Below programs illustrate the java.lang.StrictMath.atan() method:
Program 1:
// Java praogram to illustrate the // java.lang.StrictMath.atan() import java.lang.*; public class Geeks { public static void main(String[] args) { double num1 = 0.70, num2 = 55.00, num3 = 0; double atanValue = StrictMath.atan(num1); System.out.println("The arc tangent of " + num1 + " = " + atanValue); atanValue = StrictMath.atan(num2); System.out.println("The arc tangent of " + num2 + " = " + atanValue); atanValue = StrictMath.atan(num3); System.out.println("The arc tangent of " + num3 + " = " + atanValue); } } |
The arc tangent of 0.7 = 0.6107259643892086 The arc tangent of 55.0 = 1.5526165117219184 The arc tangent of 0.0 = 0.0
Program 2:
// Java praogram to illustrate the // java.lang.StrictMath.atan() import java.lang.*; public class Geeks { public static void main(String[] args) { double num1 = -0.52, num2 = -71.00, num3 = 0; double atanValue = StrictMath.atan(num1); System.out.println("The arc tangent of " + num1 + " = " + atanValue); atanValue = StrictMath.atan(num2); System.out.println("The arc tangent of " + num2 + " = " + atanValue); atanValue = StrictMath.atan(num3); System.out.println("The arc tangent of " + num3 + " = " + atanValue); } } |
The arc tangent of -0.52 = -0.4795192919925962 The arc tangent of -71.0 = -1.5567127509720364 The arc tangent of 0.0 = 0.0
Recommended Posts:
- Java atan() method with Examples
- StrictMath log() Method In Java
- StrictMath pow() Method in Java
- StrictMath sin() Method in Java
- StrictMath tan() Method in Java
- StrictMath exp() Method in Java
- StrictMath signum() Method in Java
- StrictMath cos() Method in Java with Examples
- StrictMath sqrt() Method in Java
- StrictMath log10() Method in Java
- StrictMath IEEEremainder() Method in Java
- StrictMath ulp() Method In Java with Examples
- StrictMath cosh() Method in Java
- StrictMath getExponent() Method In Java
- StrictMath floor() Method in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



