Java.lang.StrictMath.tan() Method
Advertisements
Description
The java.lang.StrictMath.tan() method returns the trigonometric tangent of an angle.It include these cases:
- If the argument is NaN or an infinity, then the result is NaN.
- If the argument is zero, then the result is a zero with the same sign as the argument.
Declaration
Following is the declaration for java.lang.StrictMath.tan() method
public static double tan(double a)
Parameters
a -- This is an angle, in radians.
Return Value
This method returns the tangent of the argument.
Exception
NA
Example
The following example shows the usage of java.lang.StrictMath.tan() method.
package com.tutorialspoint;
import java.lang.*;
public class StrictMathDemo {
public static void main(String[] args) {
double d1 = (45*Math.PI)/180 , d2 = 0.0;
// returns the trigonometric tangent of an angle
double tanValue = StrictMath.tan(d1);
System.out.println("tangent value of d1 : " + tanValue);
tanValue = StrictMath.tan(d2);
System.out.println("tangent value of d2 : " + tanValue);
}
}
Let us compile and run the above program, this will produce the following result:
tangent value of d1 : 0.9999999999999999 tangent value of d2 : 0.0