exp()
Anonymous contributor
Published Oct 27, 2023
Contribute to Docs
The exp()
method in Kotlin’s math
class is used to calculate Euler’s number e raised to the power of a given number.
Syntax
exp(number)
number
: A number of typeDouble
orFloat
. The method returns a number, of the same type given.
Example
This example demonstrates a basic implementation of the exp()
method.
import kotlin.math.expfun main() {val number = 3.0val ePowNumber = exp(number)println("Euler's number e raised to the power of $number is $ePowNumber.")}
The code above will result in the following output:
Euler's number e raised to the power of 3.0 is 20.085536923187668.
All contributors
- Anonymous contributor
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.