cosh()
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
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
- Career path
Computer Science
Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!Includes 6 CoursesWith Professional CertificationBeginner Friendly75 hours - Free course
Learn Kotlin
Learn Kotlin, the expressive, open-source programming language developed by JetBrains.Beginner Friendly9 hours