In C#, Math.Sinh(value) returns the hyperbolic sine of a number. It is built from the exponential function: (ex - e-x) / 2. Math.Sinh(0) is 0 and Math.Sinh(1) is about 1.1752.
Do not confuse it with Sin(). Ordinary sine is about angles and circles and stays between -1 and 1. Hyperbolic sine is about a curve called a hyperbola, and it grows without limit. The input is not an angle, so radians and degrees do not matter. Hyperbolic functions turn up in physics, in neural networks, and in the shape of a hanging cable.
This is a static member of the static class System.Math. You call it with the class name, such as Math.Sinh(...). There is no Math object to create. All the work is done by the method you call, and it never changes your variables. Sinh is in every .NET version. It takes and returns double.
Syntax
Pass any number. The answer is a double that grows quickly as the number gets bigger.
C#
double a = Math.Sinh(0); // 0
double b = Math.Sinh(1); // 1.1752011936438014
double c = Math.Sinh(-1); // -1.1752011936438014
Call
What it does
Math.Sinh(0)
Returns 0.
Math.Sinh(1)
Returns about 1.1752.
Math.Sinh(-1)
Returns about -1.1752. The sign follows the input.
Math.Sinh(1000)
Returns Infinity. The answer is too large for a double.
Sinh is an odd function: Sinh(-x) equals -Sinh(x). It overflows to Infinity (or -Infinity) for inputs beyond about 710 (and -710). Round non-whole answers before printing them. The method never throws.
Library declarations
C#
public static double Sinh(double value);
Parameters
Parameter
Description
value
Required. Any double. It is a plain number, not an angle.
Return Value
Return Value
Description
double
The hyperbolic sine of value. Infinity or -Infinity for very large inputs, NaN for NaN.
C# Examples
Example 1 — Hyperbolic Sine of a Few Numbers
Print Sinh for 0, 1, -1, and 2, rounded to 4 decimals.
C#
using System;
using System.Globalization;
class Program {
static string R(double value) {
return Math.Round(value, 4).ToString(CultureInfo.InvariantCulture);
}
static void Main() {
Console.WriteLine(R(Math.Sinh(0)));
Console.WriteLine(R(Math.Sinh(1)));
Console.WriteLine(R(Math.Sinh(-1)));
Console.WriteLine(R(Math.Sinh(2)));
}
}
Output
0
1.1752
-1.1752
3.6269
How It Works
Zero. e to the 0 is 1, so (1 - 1) / 2 is 0.
One.Sinh(1) is (2.7183 - 0.3679) / 2, about 1.1752.
Minus one. The answer has the opposite sign, -1.1752. Sinh is an odd function.
Two. It grows fast: Sinh(2) is about 3.6269, more than three times the value at 1.
Example 2 — Rebuild Sinh from Exp
Compute Sinh with the definition and compare it with the built-in method.
C#
using System;
using System.Globalization;
class Program {
static string R(double value) {
return Math.Round(value, 6).ToString(CultureInfo.InvariantCulture);
}
static void Main() {
double x = 1.5;
double byFormula = (Math.Exp(x) - Math.Exp(-x)) / 2;
Console.WriteLine(R(byFormula));
Console.WriteLine(R(Math.Sinh(x)));
Console.WriteLine(R(byFormula) == R(Math.Sinh(x)));
Console.WriteLine(R(Math.Sinh(-x)) == "-" + R(Math.Sinh(x)));
}
}
Output
2.129279
2.129279
True
True
How It Works
The definition. Hyperbolic sine is half of e to the x minus e to the minus x. Math.Exp supplies both parts.
Same answer. The formula and Math.Sinh(1.5) both give about 2.129279 when rounded to 6 places.
Compare as text. Rounding first and comparing the two texts avoids the tiny differences in the last digits of a double. The result is True.
Odd function.Sinh(-1.5) is exactly the same number with a minus sign in front, so the last check is True.
Example 3 — Very Large Inputs
See that Sinh overflows to infinity for huge numbers without throwing, and how infinity and NaN pass through.
C#
using System;
class Program {
static void Main() {
Console.WriteLine(Math.Sinh(1000));
Console.WriteLine(Math.Sinh(-1000));
Console.WriteLine(Math.Sinh(double.PositiveInfinity));
Console.WriteLine(Math.Sinh(double.NaN));
}
}
Output
Infinity
-Infinity
Infinity
NaN
How It Works
Too big.Sinh(1000) is about e to the 1000 divided by 2. That is far larger than the biggest double, so the answer is Infinity.
Too big and negative. For -1000, the answer would be a huge negative number, so you get -Infinity.
Infinity in. Positive infinity as input gives positive infinity.
NaN in. "Not a number" stays NaN. None of these cases throws an exception.
Frequently Asked Questions
It returns the hyperbolic sine of a number, defined as (e^x - e^-x) / 2. Math.Sinh(0) is 0 and Math.Sinh(1) is about 1.1752.
Sin works with angles in radians and always returns -1 to 1. Sinh works with a plain number, grows without limit, and is based on the exponential function.
No. The input is not an angle, so radians and degrees do not apply. It is just a number.
For inputs above roughly 710 it overflows to Infinity, and for inputs below roughly -710 it gives -Infinity. No exception is thrown.
No. Math is a static class, so you call Math.Sinh(...) straight on the class name. You cannot write new Math(), and there is no variable to keep.