Java StrictMath cosh()方法

Java StrictMath cosh()方法

java.lang.StrictMath.cosh() 是Java中的一个内置方法,用于返回给定双倍参数的双曲余弦值。

  • 当参数为NaN时,该方法返回NaN。
  • 当参数为无穷大时,该方法返回一个正的无穷大。
  • 当给定参数为0.0时,该方法返回1.0。

语法:

public static double cosh(double num)

参数。该方法接受一个双倍类型的参数num,其双曲余弦值将被返回。

返回值:该方法返回num的双曲余弦值。

例子 :

Input: num = 60.0
Output: 5.710036949078421E25

Input: num = 0.0
Output: 1.0

以下程序说明了java.lang.StrictMath.cosh()方法:

程序1:

// Java program to illustrate the
// java.lang.StrictMath.cosh()
import java.lang.*;
  
public class Geeks {
  
    public static void main(String[] args)
    {
  
        double num1 = 78.8, num2 = 0.0, num3 = 1.0;
  
        // It returns the hyperbolic cosine of
        // specified angle in radian
        double coshvalue = StrictMath.cosh(num1);
        System.out.println("The cosh of "+
                     num1+" = " + coshvalue);
  
        coshvalue = StrictMath.cosh(num2);
        System.out.println("The cosh of "+
                     num2+" = " + coshvalue);
  
        coshvalue = StrictMath.cosh(num3);
        System.out.println("The cosh of "+
                     num3+" = " + coshvalue);
    }
}

输出:

The cosh of 78.8 = 8.344016962852523E33
The cosh of 0.0 = 1.0
The cosh of 1.0 = 1.543080634815244

程序2:

// Java program to illustrate the
// java.lang.StrictMath.cosh()
import java.lang.*;
  
public class Geeks {
  
    public static void main(String[] args)
    {
  
        double num1 = (30 * (Math.PI)) / 180;
        double num2 = 11.0, num3 = 45.0;
  
        // It returns the hyperbolic cosine of 
        // angle in radian
        double coshvalue = StrictMath.cosh(num1);
        System.out.println("The cosh of "+
                     num1+" = " + coshvalue);
  
        coshvalue = StrictMath.cosh(num2);
        System.out.println("The cosh of "+
                     num2+" = " + coshvalue);
  
        coshvalue = StrictMath.cosh(num3);
        System.out.println("The cosh of "+
                     num3+" = " + coshvalue);    
    }
}

输出:

The cosh of 0.5235987755982988 = 1.1402383210764286
The cosh of 11.0 = 29937.070865949758
The cosh of 45.0 = 1.7467135528742547E19

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程