Java Math tan() Method
Example
Return the tangent of different angles:
System.out.println(Math.tan(0.5));
System.out.println(Math.tan(-0.5));
System.out.println(Math.tan(1));
System.out.println(Math.tan(-3));
System.out.println(Math.tan(Math.PI/4));
Definition and Usage
The tan()
method returns the tangent of an angle.
Note: Angles are measured in radians.
Tip: You can use the constant Math.PI to make fractions of PI for angles.
Syntax
public static double tan(double angle)
Parameter Values
Parameter | Description |
---|---|
angle | Required. An angle in radians to find the tangent of. |
Technical Details
Returns: | A double value representing the tangent of an angle. |
---|---|
Java version: | Any |
❮ Math Methods