math.asin java_Java Math asin()用法及代码示例

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值