C# - Math Cosh() Method
The C# Math Cosh() method returns hyperbolic cosine of a value. The hyperbolic cosine of x is defined as:
where e is an Euler's number.
In special cases it returns the following:
- If the argument is NaN, the method returns NaN.
- If the argument is PositiveInfinity or NegativeInfinity, the method returns PositiveInfinity.
Syntax
public static double Cosh(double arg);
Parameters
arg |
Specify the value. |
Return Value
Returns the hyperbolic cosine of a value.
Example:
In the below example, Cosh() method is used to find out the hyperbolic cosine of a value.
using System; class MyProgram { static void Main(string[] args) { Console.WriteLine(Math.Cosh(0)); Console.WriteLine(Math.Cosh(2)); Console.WriteLine(Math.Cosh(4)); } }
The output of the above code will be:
1 3.76219569108363 27.3082328360165
❮ C# Math Methods