Java Math asin()方法及其示例

爪哇。朗,数学。asin()返回中间某个角度的正弦弧 -pi/2和pi/2。 弧正弦也称为正弦的逆。

null
  • 如果参数为NaN或其绝对值大于1,则结果为NaN。
  • 如果参数为零,则结果为零,符号与参数相同。

语法:

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

返回: 此方法返回参数的弧正弦。

例1: 来展示java的工作原理。朗,数学。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));
}
}


输出:

NaN0.0548586473412512041.57079632679489660.0-1.5707963267948966NaN
© 版权声明
THE END
喜欢就支持一下吧
点赞12 分享