java.lang.Math.asin()返回介于-pi /2和pi /2之间的角度的反正弦。反正弦也称为正弦的逆。
如果参数为NaN或其绝对值大于1,则结果为NaN。
如果自变量为零,则结果为零,其符号与自变量相同。
用法:
public static double asin(double angle)
Parameter:
angle: the value whose arc sine is to be returned.
返回:
此方法返回参数的反正弦值。
范例1:展示java.lang.Math.asin()方法的用法。
// 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
System.out.println(Math.asin(a));
// convert Math.PI to radians
double b = Math.toRadians(a);
System.out.println(Math.asin(b));
double c = 1.0;
System.out.println(Math.asin(c));
double d = 0.0;
System.out.println(Math.asin(d));
double e = -1.0;
System.out.println(Math.asin(e));
double f = 1.5;
// value of f does not lie in between -1 and 1
// so output is NaN
System.out.println(Math.asin(f));
}
}
输出:
NaN
0.054858647341251204
1.5707963267948966
0.0
-1.5707963267948966
NaN