Java - StrictMath sinh(double x) 方法



描述

Java StrictMath sinh(double x) 方法返回雙精度值的雙曲正弦值。雙曲正弦 x 定義為 (ex - e-x)/2,其中 e 是尤拉數。特殊情況 -

  • 如果引數是 NaN,則結果為 NaN。

  • 如果引數是無限大,則結果是與引數符號相同的無限大。

  • 如果引數是零,則結果是與引數符號相同的零。

計算結果必須在精確結果的 2.5 ulps 之內。

宣告

以下是 java.lang.StrictMath.sinh() 方法的宣告

public static double sinh(double x)

引數

x - 要返回其雙曲正弦值的數字。

返回值

此方法返回 x 的雙曲正弦值。

異常

示例 1

以下示例演示瞭如何使用 StrictMath sinh() 方法獲取正雙精度值的雙曲正弦值。

package com.tutorialspoint;
public class StrictMathDemo {
   public static void main(String[] args) {

      // get a double number
      double x = 45.0;

      // convert it to radian
      x = StrictMath.toRadians(x);

      // print the hyperbolic sine for this double
      System.out.println("StrictMath.sinh(" + x + ")=" + StrictMath.sinh(x));
   }
}

輸出

讓我們編譯並執行上述程式,這將產生以下結果 -

StrictMath.sinh(0.7853981633974483)=0.8686709614860095

示例 2

以下示例演示瞭如何使用 StrictMath sinh() 方法獲取負雙精度值的雙曲正弦值。

package com.tutorialspoint;
public class StrictMathDemo {
   public static void main(String[] args) {

      // get a double number
      double x = -45.0;

      // convert it to radian
      x = StrictMath.toRadians(x);

      // print the hyperbolic sine for this double
      System.out.println("StrictMath.sinh(" + x + ")=" + StrictMath.sinh(x));
   }
}

輸出

讓我們編譯並執行上述程式,這將產生以下結果 -

StrictMath.sinh(-0.7853981633974483)=-0.8686709614860095

示例 3

以下示例演示瞭如何使用 StrictMath sinh() 方法獲取零雙精度值的雙曲正弦值。

package com.tutorialspoint;
public class StrictMathDemo {
   public static void main(String[] args) {

      // get a double number
      double x = 0.0;

      // convert it to radian
      x = StrictMath.toRadians(x);

      // print the hyperbolic sine for this double
      System.out.println("StrictMath.sinh(" + x + ")=" + StrictMath.sinh(x));
   }
}

輸出

讓我們編譯並執行上述程式,這將產生以下結果 -

StrictMath.sinh(0.0)=0.0
java_lang_strictmath.htm
廣告

© . All rights reserved.