C# Tutorial C# Advanced C# References

C# Math - Acosh() Function



The C# Acosh() function returns inverse hyperbolic cosine of a value. The inverse hyperbolic cosine of x is defined as:

Acosh

In special cases it returns the following:

  • If the argument is NaN, the method returns NaN.
  • If the value of argument is less than 1, the method returns NaN.

Syntax

public static double Acosh (double x);

Parameters

x Specify the value.

Return Value

Returns the inverse hyperbolic cosine of a value.

Example:

In the example below, Acosh() function is used to find out the inverse hyperbolic cosine of a value.

using System;

class MyProgram {
  static void Main(string[] args) {
    Console.WriteLine("Math.Acosh(0) = "
                      + Math.Acosh(0));
    Console.WriteLine("Math.Acosh(1) = "
                      + Math.Acosh(1));
    Console.WriteLine("Math.Acosh(2) = "
                      + Math.Acosh(2));
    Console.WriteLine("Math.Acosh(Double.NaN) = "
                      + Math.Acosh(Double.NaN));
    Console.WriteLine("Math.Acosh(Double.NegativeInfinity) = "
                      + Math.Acosh(Double.NegativeInfinity));
    Console.WriteLine("Math.Acosh(Double.PositiveInfinity) = "
                      + Math.Acosh(Double.PositiveInfinity));
  }
}

The output of the above code will be:

Math.Acosh(0) = NaN
Math.Acosh(1) = 0
Math.Acosh(2) = 1.31695789692482
Math.Acosh(Double.NaN) = NaN
Math.Acosh(Double.NegativeInfinity) = NaN
Math.Acosh(Double.PositiveInfinity) = Infinity

❮ C# Math Methods