In C#, Math.Asinh(d) is the inverse hyperbolic sine. It undoes Sinh(): if Sinh(x) is d, then Asinh(d) is x. Math.Asinh(0) is 0 and Math.Asinh(1) is about 0.8814.
Think of a lock and a key. Sinh locks a number, and Asinh unlocks it. Any real number can be an input, because the curve of Sinh covers every height. The answer is negative for negative input and grows slowly, like a logarithm. It equals Log(x + Sqrt(x * x + 1)), but the built-in method stays accurate for very large and very small values where that formula breaks.
This is a static member of the static class System.Math. You call it with the class name, such as Math.Asinh(...). There is no Math object to create. All the work is done by the method you call, and it never changes your variables. Math.Asinh was added in .NET Core 3.0. It is not in classic .NET Framework.
Syntax
Pass any number. The answer is a double.
C#
double a = Math.Asinh(0); // 0
double b = Math.Asinh(1); // 0.881373587019543
double c = Math.Asinh(-1); // -0.881373587019543
Call
What it does
Math.Asinh(0)
Returns 0.
Math.Asinh(1)
Returns about 0.8814.
Math.Asinh(-1)
Returns about -0.8814.
Math.Asinh(double.PositiveInfinity)
Returns Infinity.
Every real number is allowed, so there is no NaN from range problems (only NaN input gives NaN). Asinh is an odd function: Asinh(-x) equals -Asinh(x). Round non-whole results before showing them.
Library declarations
C#
public static double Asinh(double d);
Parameters
Parameter
Description
d
Required. Any double (the value whose inverse hyperbolic sine you want).
Return Value
Return Value
Description
double
The number x such that Sinh(x) equals d. Infinity or -Infinity for infinite input, NaN for NaN.
C# Examples
Example 1 — Asinh of a Few Numbers
Print Asinh for 0, 1, -1, and 10, 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.Asinh(0)));
Console.WriteLine(R(Math.Asinh(1)));
Console.WriteLine(R(Math.Asinh(-1)));
Console.WriteLine(R(Math.Asinh(10)));
}
}
Output
0
0.8814
-0.8814
2.9982
How It Works
Zero.Sinh(0) is 0, so Asinh(0) is 0.
One. You need Sinh of about 0.8814 to reach 1, so the answer is 0.8814.
Minus one. The answer is -0.8814. The function is odd, so the sign simply follows the input.
Ten. The answer grows slowly, only about 2.9982, even though the input is ten times bigger than 1.
Example 2 — Asinh Reverses Sinh
Apply Sinh and then Asinh, and check you get the starting number back.
C#
using System;
using System.Globalization;
class Program {
static string R(double value) {
return Math.Round(value, 6).ToString(CultureInfo.InvariantCulture);
}
static void Main() {
foreach (double x in new double[] { 0.5, 2, -3 }) {
double locked = Math.Sinh(x);
Console.WriteLine(R(Math.Asinh(locked)));
}
}
}
Output
0.5
2
-3
How It Works
Lock with Sinh. The variable locked holds Sinh(x), a number you cannot easily recognise.
Unlock with Asinh.Math.Asinh(locked) returns the original x, apart from a tiny rounding error.
Rounding. The helper rounds to 6 places, so the tiny error in the last digits does not show up.
Negative works. Starting from -3 gives -3 again. Unlike Acosh, Asinh covers the whole number line.
Example 3 — Compare with the Log Formula
Compare Asinh with the Log formula for a small number, then try a huge number where the formula fails.
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;
Console.WriteLine(R(Math.Log(x + Math.Sqrt(x * x + 1))));
Console.WriteLine(R(Math.Asinh(x)));
double big = 1e300;
Console.WriteLine(Math.Asinh(big) > 690);
Console.WriteLine(Math.Log(big + Math.Sqrt(big * big + 1)));
}
}
Output
0.881374
0.881374
True
Infinity
How It Works
The formula. For ordinary numbers, Asinh(x) equals Log(x + Sqrt(x * x + 1)). For 1 it gives about 0.881374.
Same answer. The built-in method gives the same 0.881374 after rounding.
A huge input. For 1e300, the real answer is about 691. Math.Asinh handles this correctly, so the test > 690 is True.
The formula breaks.big * big is too large for a double and becomes Infinity, so the formula returns Infinity. Use the built-in method for big values.
Frequently Asked Questions
It returns the inverse hyperbolic sine: the number whose Sinh is the input. Math.Asinh(1) is about 0.8814.
It was added in .NET Core 3.0, so it is in modern .NET. It is not in classic .NET Framework.
Yes. Every real number is a legal input, including negative numbers. Only NaN input returns NaN.
Yes: Math.Log(x + Math.Sqrt(x * x + 1)). It works for moderate numbers, but the built-in Math.Asinh is more accurate for very large or very small values.
No. Math is a static class, so you call Math.Asinh(...) straight on the class name. You cannot write new Math(), and there is no variable to keep.