java.lang.StrictMath.asin()方法實例
java.lang.StrictMath.asin() 方法返回一個值。反正弦返回角度是-pi/2到pi/2的範圍內。它包括以下情況:
- 如果參數爲NaN或它的絕對值大於1,那麼結果爲NaN。
- 如果參數是0,那麼結果是相同參數符號爲零。
聲明
以下是**java.lang.StrictMath.asin()**方法的聲明
public static double asin(double a)
參數
- a -- 這是要返回其反正弦的值。
返回值
此方法返回參數的反正弦。
異常
- NA
例子
下面的例子顯示java.lang.StrictMath.asin()方法的使用。
package com.yiibai; import java.lang.*; public class StrictMathDemo { public static void main(String[] args) { double d1 = 0.90 , d2 = 5.00, d3 = 0; // returns the arc sine of a value double dAbsValue = StrictMath.asin(d1); System.out.println("arc sine value of " + d1 + " = " + dAbsValue); // returns NaN if argument is NaN or its absolute value is greater than 1 dAbsValue = StrictMath.asin(d2); System.out.println("arc sine value of " + d2 + " = " + dAbsValue); // returns zero if the argument is 0 dAbsValue = StrictMath.asin(d3); System.out.println("arc sine value of " + d3 + " = " + dAbsValue); } }
讓我們來編譯和運行上面的程序,這將產生以下結果:
arc sine value of 0.9 = 1.1197695149986342 arc sine value of 5.0 = NaN arc sine value of 0.0 = 0.0