asin() in Java

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

Syntax:

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

This method returns the arcsine 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 or its absolute value is greater than 1, 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: value whose arc sine is to be returned.

Returns: the arc sine of the argument.

Approach

Java

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

        double a = 0.5;

        System.out.println(Math.asin(a));
    }
}

Output:

0.5235987755982989

No comments:

Post a Comment