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
相關用法
- Java StrictMath asin()用法及代碼示例
- Java Java.math.BigInteger.modInverse()用法及代碼示例
- Java Java.math.BigInteger.probablePrime()用法及代碼示例
- Java Math exp()用法及代碼示例
- Java Math pow()用法及代碼示例
- Java Math log()用法及代碼示例
- Java Math sin()用法及代碼示例
- Java Math getExponent()用法及代碼示例
- Java Math ulp()用法及代碼示例
- Java Math addExact(int a, int b)用法及代碼示例
- Java Math subtractExact(int a , int b)用法及代碼示例
- Java Math abs()用法及代碼示例
- Java Math cos()用法及代碼示例
- Java Math negateExact()用法及代碼示例
- Java Math incrementExact(int x)用法及代碼示例
注:本文由純淨天空篩選整理自ChetnaAgarwal大神的英文原創作品 Java Math asin() method with Example。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。