Kotlin 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 typeDoubleorFloat. 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.
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