.tanh()
Published Oct 31, 2023
Contribute to Docs
The .tanh()
method in Kotlin’s math
class computes the hyperbolic tangent of an angle given in radians. The method takes the angle as its one and only parameter and returns the computed value as Double
or Float
type.
Syntax
tanh(x)
-x
: This parameter takes a value of an angle in Double
or Float
type.
Example
The following code is basic implementation of math.tanh()
.
import kotlin.math.*fun main() {val x = 1.0val y = tanh(x)// print resultsprintln(y)}
This example will output:
0.7615941559557649
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.