atanh()
Published Oct 25, 2023
Contribute to Docs
The atanh()
method in Kotlin’s math
class returns the inverse hyperbolic tangent of any number between -1.0
and 1.0
in radians.
Syntax
import kotlin.math.*
val y = atanh(x)
x
: A number between-1.0
and1.0
, of typeDouble
orFloat
.
Special Cases:
atanh(NaN)
=NaN
atanh(x)
=NaN
if x > 1 || x < -1atanh(1.0)
=+Inf
atanh(-1.0)
=-Inf
Example
The following code is a basic implementation of math.atanh(x)
.
import kotlin.math.*fun main() {val x = -0.1val y = atanh(x)// Print resultsprintln(y)}
It will output:
-0.100335348
The returned value is y
such that tanh(y) == x
.
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.