atan() in Java

atan(): This method is available in the Math class of Java.

Syntax:

double java.lang.Math.atan(double a)

This method required one parameter of type double. This method returns the arc tangent of a value; the returned angle is in the range -pi/2 through pi/2 or we can say in the range [-π/2,π/2].

Special cases:

1.If the argument is NaN, then the result is NaN. 

2.If the argument is zero, then the result is a zero with the same sign as the argument.

The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

Parameters: One parameter is required for this method.

a: The value whose arc tangent is to be returned.

Returns: the arc tangent of the argument.

Approach

Java

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

        double a = 0.5;
        System.out.println(Math.atan(a));

    }
}

Output:

0.4636476090008061

No comments:

Post a Comment