Skip to content
Related Articles

Related Articles

Improve Article
Java Math asin() method with Example
  • Last Updated : 06 Apr, 2018

The java.lang.Math.asin() returns the arc sine of an angle in between -pi/2 and pi/2. Arc sine is also called as an inverse of a sine.

  • 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.

Syntax :

public static double asin(double angle)
Parameter :
angle : the value whose arc sine is to be returned.

Return :
This method returns the arc sine of the argument.

Example 1 : To show working of java.lang.Math.asin() method.

// Java program to demonstrate working
// of java.lang.Math.asin() method
import java.lang.Math;
class Gfg {
    // driver code
    public static void main(String args[])
        double a = Math.PI;
        // Output is NaN, because Math.PI gives 3.141 value
        // greater than 1
        // convert Math.PI to radians
        double b = Math.toRadians(a);
        double c = 1.0;
        double d = 0.0;
        double e = -1.0;
        double f = 1.5;
        // value of f does not lie in between -1 and 1
        // so output is NaN



Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :