Kotlin 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.0and1.0, of typeDoubleorFloat.
Special Cases:
atanh(NaN)=NaNatanh(x)=NaNif x > 1 || x < -1atanh(1.0)=+Infatanh(-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.
Learn Kotlin on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours
- Learn Kotlin, the expressive, open-source programming language developed by JetBrains.
- Beginner Friendly.9 hours