That is, Math.expm1(4.0) = e4.0-1
. Also in mathematics, Math.expm1(x) = e
x
-1
.
The syntax of the expm1()
method is:
Math.expm1(double a)
Note: The expm1()
method is a static method. Hence, we can call the method directly using the class name Math
.
expm1() Parameters
- a - number to be raised as power of e
expm1() Return Values
- returns ea-1 for the argument a
Note: Here, e is the Euler's number whose value is 2.71828
Example: Java Math.expm1()
class Main {
public static void main(String[] args) {
// Math.expm1() method
double a = 4.0d;
System.out.println(Math.expm1(a)); // 53.598150033144236
// without using Math.expm1()
// value of Euler Number
double euler = 2.71828d;
System.out.println(Math.pow(euler, a)-1); // 53.5980031309658
}
}
In the above example, we have used the Math.pow() method to compute the e4.0 value. Here, we can see that
Math.expm1(4.0) = e4.0-1