In mathematics, the exponential function is the function `e`

^{x}, where `e`

is the number (approximately 2.718281828) such that the function `e`

^{x} equals its own derivative. The function `f(x) = e`

^{x} at the point `x = 0`

is equal to `1`

.

```
package org.kodejava.example.math;
public class ExponentExample {
public static void main(String[] args) {
double x = 0.0d;
// calculates e raised to the power of x (e^x)
double fx = Math.exp(x);
// calculates e raised to the power of x minus 1 (e^x - 1)
double fxm1 = Math.expm1(x);
System.out.println("fx = " + fx);
System.out.println("fxm1 = " + fxm1);
}
}
```

### Wayan Saryada

Founder at Kode Java Org

I am a programmer, a runner, a recreational diver, currently live in the island of Bali, Indonesia. Mostly programming in Java, Spring Framework, Hibernate / JPA. You can support my works by donating here. Thank you 🥳

#### Latest posts by Wayan Saryada (see all)

- How do I clear the current command line in terminal? - February 14, 2019
- How do I generate random alphanumeric strings? - February 7, 2019
- Why do I get ArrayIndexOutOfBoundsException in Java? - January 29, 2019

thank you so much. really helped