Java exp() Method
The exp() method is used to return e (the base of natural logarithms) raised to the power of the argument.
Syntax
This method has the following syntax formats:
double exp(double d)
Parameters
d-- any primitive data type.
Return Value
Returns e raised to the power of the argument.
Example
public class Test{
public static void main(String args[]){
double x = 11.635;
double y = 2.76;
System.out.printf("e 的值为 %.4f%n", Math.E);
System.out.printf("exp(%.3f) 为 %.3f%n", x, Math.exp(x));
}
}
Compile the above program, the output result is:
e 的值为 2.7183 exp(11.635) 为 112983.831
Other Extensions
Java Number Class