math.asinh(x) returns the inverse hyperbolic sine of x as a float, undoing math.sinh().
It is defined for all real numbers (negative, zero, and positive) and behaves like ln(2x) for large x while staying linear near 0, making it ideal for log-scaling values that cross zero.
math.asinh() is a function in Python's standard math module: import it with import math and call math.asinh(...), or import the name directly with from math import asinh.
Syntax
Import math and pass any real number.
python
import math
y = math.asinh(x)
Call
What it does
math.asinh(0)
Returns 0.0.
math.asinh(1)
Returns approximately 0.881373....
math.asinh(-1)
Returns approximately -0.881373....
math.asinh(float("inf"))
Returns inf.
Because asinh(x) handles negatives and zeros naturally, data scientists use it as a drop-in symmetric alternative to log().
Function signatures
python
math.asinh(x, /)
# returns: float inverse hyperbolic sine for any real x
Parameters
Parameter
Description
x
Required positional real number (int or float).
Return Value
Return Value
Description
float
Inverse hyperbolic sine of x; preserves inf, -inf, -0.0, and nan.
Python Examples
Example 1 — Compress Skewed Profit and Loss Figures With asinh
Transform negative losses, zero, and large positive profits onto a compact scale.
python
import math
profits = [-10000, -100, 0, 100, 10000]
for p in profits:
scaled = math.asinh(p)
print(f"profit={p:>6} -> scaled={scaled:+7.4f}")
Accepts negatives and zero. Unlike math.log() which rejects 0 and negatives, asinh() transforms every figure smoothly.
Logarithmic compression. Jumping 100x from 100 to 10000 changes the transformed scale by about 4.6 units.
Odd symmetry preserved. Losses and equal-sized gains map to opposite signs with identical magnitudes.
Example 2 — Recover Original Numbers From math.sinh()
Confirm math.asinh(math.sinh(x)) returns x and verify odd symmetry.
python
import math
for x in [-2.5, 0.0, 2.5]:
back = math.asinh(math.sinh(x))
print(f"{x:+4.1f} -> {back:+4.1f} close={math.isclose(back, x)}")
print(math.asinh(-5.0) == -math.asinh(5.0))
Bijective inverse. Because sinh() is strictly increasing everywhere, asinh() recovers any real input cleanly.
Identity check.math.isclose() confirms round-trip equality within float tolerance.
Exact negative reflection. Negating 5.0 negates the output bit-for-bit.
Example 3 — Evaluate Large Negative Values Without Cancellation
Compare math.asinh(-1e20) with infinities without losing precision like log(x + sqrt(x*x+1)).
python
import math
print(f"{math.asinh(-1e20):.4f}")
print(math.asinh(float("inf")), math.asinh(float("-inf")))
Output
-46.7448
inf -inf
How It Works
Avoids catastrophic cancellation. Evaluating x + sqrt(x*x + 1) at -1e20 cancels to zero in binary64, whereas math.asinh() evaluates -asinh(-x) cleanly.
Infinities preserved. Positive and negative infinity pass straight through without error.
Always finite for finite inputs. Any finite float input produces a finite output.
Frequently Asked Questions
All real numbers (from -inf to +inf). It never raises ValueError for real inputs.
Logarithms reject zero and negative numbers, whereas asinh(x) behaves like a logarithm for large |x| while staying smooth and odd through 0.
For large negative x, x and sqrt(x*x + 1) nearly cancel and overflow or collapse to zero. math.asinh() handles large positive and negative inputs safely.