The java.lang.StrictMath.asin() is an inbuilt method of StrictMath class which is used to return the arc sine of a specified value. The returned angle is in within the range of -pi/2 and pi/2. The method gives rise to two special results:
- If the absolute value of the argument is greater than 1 or the argument is itself a NaN then the result is also NaN.
- If the passed argument is 0, then the output is also 0 with the same sign as the argument.
Syntax :
public static double asin(double val)
Parameters: This method accepts one parameter val of double type and refers to the value whose arc sine is to be returned.
Return Value : The method returns the arc sine value of the argument.
Examples :
Input: val = 0.72 Output: 0.80380231893303 Input: val = 7.0 Output: NAN Input: val = 0.0 Output: 0.0
Below programs illustrate the java.lang.StrictMath.asin() method:
Program 1:
// Java program to illustrate the// java.lang.StrictMath.asin()import java.lang.*;Â Â public class Geeks {Â Â Â Â Â Â public static void main(String[] args)Â Â Â Â {Â Â Â Â Â Â Â Â Â Â double val1 = 0.65, val2 = 3.00, val3 = 0;Â Â Â Â Â Â Â Â Â Â double asinvalue = StrictMath.asin(val1);Â Â Â Â Â Â Â Â System.out.println(" The arc sine value is = "+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â asinvalue);Â Â Â Â Â Â Â Â Â Â asinvalue = StrictMath.asin(val2);Â Â Â Â Â Â Â Â System.out.println("The arc sine value is = "+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â asinvalue);Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â asinvalue = StrictMath.asin(val3);Â Â Â Â Â Â Â Â System.out.println("The arc sine value is = "+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â asinvalue);Â Â Â Â }} |
The arc sine value is = 0.7075844367253556 The arc sine value is = NaN The arc sine value is = 0.0
Program 2:
// Java program to illustrate the// java.lang.StrictMath.asin()import java.lang.*;Â Â public class Geeks {Â Â Â Â Â Â public static void main(String[] args)Â Â Â Â {Â Â Â Â Â Â Â Â Â Â double val1 = -0.85, val2 = -2.00, val3 = 0;Â Â Â Â Â Â Â Â Â Â double asinvalue = StrictMath.asin(val1);Â Â Â Â Â Â Â Â System.out.println(" The arc sine value is = "+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â asinvalue);Â Â Â Â Â Â Â Â Â Â asinvalue = StrictMath.asin(val2);Â Â Â Â Â Â Â Â System.out.println("The arc sine value is = "+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â asinvalue);Â Â Â Â Â Â Â Â Â Â asinvalue = StrictMath.asin(val3);Â Â Â Â Â Â Â Â System.out.println("The arc sine value is= "+Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â asinvalue);Â Â Â Â }} |
The arc sine value is = -1.015985293814825 The arc sine value is = NaN The arc sine value is= 0.0
