static double cosh(double x)
描述 (Description)
java.lang.StrictMath.cosh()方法返回double值的双曲余弦值。 x的双曲余弦定义为(e x + e -x )/2 ,其中e是Euler's number包括这些情况 -
- 如果参数是NaN,则结果为NaN。
- 如果参数是无穷大的,那么结果就是正无穷大。
- 如果参数为零,则结果为1.0。
声明 (Declaration)
以下是java.lang.StrictMath.cosh()方法的声明
public static double cosh(double x)
参数 (Parameters)
x - 这是要返回双曲余弦值的数字。
返回值 (Return Value)
此方法返回x的双曲余弦值。
异常 (Exception)
NA
例子 (Example)
以下示例显示了java.lang.StrictMath.cosh()方法的用法。
package com.iowiki;
import java.lang.*;
public class StrictMathDemo {
public static void main(String[] args) {
double d1 = (60*(Math.PI))/180 , d2 = 0.0, d3 = (1.0/0.0) ;
// returns the hyperbolic cosine of specified angle in radian
double coshValue = StrictMath.cosh(d1);
System.out.println("Hyperbolic cosine of d1 = " + coshValue);
coshValue = StrictMath.cosh(d2);
System.out.println("Hyperbolic cosine of d2 = " + coshValue);
coshValue = StrictMath.cosh(d3);
System.out.println("Hyperbolic cosine of d3 = " + coshValue);
}
}
让我们编译并运行上面的程序,这将产生以下结果 -
Hyperbolic cosine of d1 = 1.600286857702386
Hyperbolic cosine of d2 = 1.0
Hyperbolic cosine of d3 = Infinity