Java.lang.Math.cosh() 方法
描述
java.lang.Math.cosh(double a) 返回 double 值的双曲余弦值。 特别案例:
如果参数为 NaN,则结果为 NaN。
如果参数为无穷大,则结果为正无穷大。
如果参数为零,则结果为 1.0。
计算结果必须在精确结果的 2.5 ulps 范围内。
声明
以下是 java.lang.Math.cosh() 方法的声明。
public static double cosh(double x)
参数
x − 要返回其双曲余弦的数字。
返回值
此方法返回 x 的双曲余弦值。
异常
NA
示例
下面的例子展示了 lang.Math.cosh() 方法的使用。
package com.tutorialspoint;
import java.lang.*;
public class MathDemo {
public static void main(String[] args) {
// get two double numbers
double x = 45.0;
double y = 180.0;
// convert them to radians
x = Math.toRadians(x);
y = Math.toRadians(y);
// print their hyperbolic cosine
System.out.println("Math.cosh(" + x + ")=" + Math.cosh(x));
System.out.println("Math.cosh(" + y + ")=" + Math.cosh(y));
}
}
让我们编译并运行上面的程序,这将产生下面的结果 −
Math.cosh(0.7853981633974483)=1.3246090892520057 Math.cosh(3.141592653589793)=11.591953275521519

