C# Tutorial C# Advanced C# References

C# Math - Sinh() Method



The C# Sinh() method returns hyperbolic sine of a value. The hyperbolic sine of x is defined as:

Sinh

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 positive infinity or negative infinity, the method returns a Double equal to argument.

Syntax

public static double Sinh(double arg);

Parameters

arg Specify the value.

Return Value

Returns the hyperbolic sine of a value.

Example:

In the example below, Sinh() method is used to find out the hyperbolic sine of a value.

using System;

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

The output of the above code will be:

Math.Sinh(-2) = -3.62686040784702
Math.Sinh(-1) = -1.1752011936438
Math.Sinh(0) = 0
Math.Sinh(1) = 1.1752011936438
Math.Sinh(2) = 3.62686040784702
Math.Sinh(Double.NaN) = NaN
Math.Sinh(Double.NegativeInfinity) = -Infinity
Math.Sinh(Double.PositiveInfinity) = Infinity

❮ C# Math Methods