Reference · Math

math.atanh

signature
math.atanh(num) -> float

What it does

The inverse hyperbolic tangent: the number whose math.tanh is the argument, as a float, as Python's math.atanh. The argument must be strictly between -1 and 1.

Examples

print(math.atanh(0), math.atanh(0.5), math.atanh(-0.5))print(math.atanh(math.tanh(0.5)))
output
0.0 0.5493061443340548 -0.54930614433405480.5

Edge cases

print(math.atanh(0.99999), math.atanh(0.9999999999999999))print(math.atanh(math.tanh(2)))print(math.atanh(-0.5), -math.atanh(0.5), math.atanh(math.nan))
output
6.1030338227611125 18.7149738751185242.0000000000000004-0.5493061443340548 -0.5493061443340548 NaN

Errors

1, -1 or anything beyond them is a runtime error (a domain error), not an error value: it stops the request, and ?? does not catch it. A value that is not a number is a runtime error too.

this one fails
print(math.atanh(1))
output
line 1: `math.atanh`: math domain error (1)
this one fails
print(math.atanh(2))
output
line 1: `math.atanh`: math domain error (2)

Chaining

print(0.5 | math.atanh)print([-0.5, 0, 0.5] | map(math.atanh))
output
0.5493061443340548[-0.5493061443340548, 0.0, 0.5493061443340548]

See also

math.tanh, math.asinh, math.acosh, math.log1p

Thread
8Useful? Like it, or add to its thread below.

Thread 0 posts

On math.atanh(): questions, tips, corrections, and code that uses it.

No posts yet. The first one opens the thread.

    Edit this page on GitHub · every example's output was made by running it (tools/refcheck.mjs) · questions on Discord or r/quillo