Python math.asinh() Function

Beginner
5 min read
Updated: Nov 2026
3 examples
math module

Definition

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)
CallWhat 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

ParameterDescription
xRequired positional real number (int or float).

Return Value

Return ValueDescription
floatInverse 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}")

How It Works

  1. Accepts negatives and zero. Unlike math.log() which rejects 0 and negatives, asinh() transforms every figure smoothly.
  2. Logarithmic compression. Jumping 100x from 100 to 10000 changes the transformed scale by about 4.6 units.
  3. 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))

How It Works

  1. Bijective inverse. Because sinh() is strictly increasing everywhere, asinh() recovers any real input cleanly.
  2. Identity check. math.isclose() confirms round-trip equality within float tolerance.
  3. 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")))

How It Works

  1. Avoids catastrophic cancellation. Evaluating x + sqrt(x*x + 1) at -1e20 cancels to zero in binary64, whereas math.asinh() evaluates -asinh(-x) cleanly.
  2. Infinities preserved. Positive and negative infinity pass straight through without error.
  3. 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.
Yes, and math.asinh(-0.0) preserves -0.0.
math.sinh(y) recovers x for every real value.

Next: math.atan()

Return the arc tangent (inverse tangent) of x in radians.

atan() →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

11 people found this page helpful