VOOZH about

URL: https://www.geeksforgeeks.org/java/strictmath-atan-method-in-java/

⇱ StrictMath atan() Method in Java - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

StrictMath atan() Method in Java

Last Updated : 29 Dec, 2021
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:
Output:
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:
Output:
The arc tangent of -0.52 = -0.4795192919925962
The arc tangent of -71.0 = -1.5567127509720364
The arc tangent of 0.0 = 0.0
Comment