Java Tutorial Java Advanced Java Resources
Python Java C++ C C# PHP R SQL DS Algo InterviewQ

Java - Math asin() Method



The Java Math asin() method returns arc sine of a value. The return value will be in the range -𝜋/2 through 𝜋/2. In special cases it returns the following:

  • If the argument is NaN or its absolute value is greater than 1, then the result is NaN.
  • If the argument is zero, then the result is a zero with the same sign as the argument.

Note: asin() is the inverse of sin().

Syntax

public static double asin(double arg)

Parameters

arg Specify the value.

Return Value

Returns the arc sine of the value.

Exception

NA.

Example:

In the example below, asin() method is used to find out the arc sine of a given value.

public class MyClass {
 public static void main(String[] args) {
  System.out.println(Math.asin(0.5));   
  System.out.println(Math.asin(1));
  System.out.println(Math.asin(2));     
 }
}

The output of the above code will be:

0.5235987755982989
1.5707963267948966
NaN

❮ Java Math Methods

5