Java atan() Method

Java Number类Java Number Class


The atan() method is used to return the arctangent value of the specified double type parameter.

Syntax

double atan(double d)

Parameters

  • d -- Any primitive data type.

Return Value

Returns the arctangent value of the specified double type parameter.

Example

public class Test{ 
    public static void main(String args[]){

        double degrees = 45.0;
        double radians = Math.toRadians(degrees);

        System.out.format("pi 的值为 %.4f%n", Math.PI);
        System.out.format("%.4f 的反正切值 %.4f 度 %n", Math.cos(radians), Math.toDegrees(Math.atan(Math.sin(radians))));

    }
}

Compile the above program, the output result is:

pi 的值为 3.1416
0.7071 的反正切值 35.2644 度 

Java Number类Java Number Class

Other Extensions