MathF.Cosh() Method in C# with Examples


The MathF.Cosh() method in C# is used to return the hyperbolic cosine of a floating-point value.

Syntax

Following is the syntax −

public static float Cosh (float val);

Above, Val is the floating-point number.

Example

Let us now see an example to implement the MathF.Cosh() method −

using System;
class Demo {
   public static void Main(){
      float val = 45.0f;
      float res = MathF.Cosh(val);
      Console.WriteLine("Cosh = "+res);
   }
}

Output

This will produce the following output −

Cosh = 1.746714E+19

Example

Let us now see another example to implement the MathF.Cosh() method −

using System;
class Demo {
   public static void Main(){
      float val = 90f;
      float res = MathF.Cosh(val);
      Console.WriteLine("Cosh = "+res);
   }
}

Output

This will produce the following output −

Cosh = Infinity

Updated on: 14-Nov-2019

14 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements