cosh()

artyspangler8 total contributions
Published Oct 23, 2023
Contribute to Docs
The cosh()
method in Kotlin’s math
class computes the hyperbolic cosine of a angle given in radians.
Syntax
import kotlin.math.*
val y = cosh(x)
x
: An angle of type Double
or Float
.
Special cases:
cosh(NaN)
yieldsNaN
cosh(+Inf|-Inf)
yields+Inf
Example
The following code is basic implementation of math.cosh()
.
import kotlin.math.*fun main(){val x = 30.0val y = cosh(x)//print resultsprintln(y)}
This example will output:
1.1402383210764286
Looking to contribute?
- 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.