exp(): This method is available in the Math class of Java.
Syntax:
double java.lang.Math.exp(double a)
This method takes one argument of type double. This method returns Euler's number e raised to the power of a double value.
Special cases:
1. If the argument is NaN, the result is NaN.
2. If the argument is positive infinity, then the result is positive infinity.
3. If the argument is negative infinity, then the result is positive zero.
The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.
Parameters: One parameter is required for this method.
a: the exponent to raise e to.
Returns:the value e^a,where e is the base of the natural logarithms.
For Example:
Math.exp(12)) = > It returns 162754.79141900392
Approach
Java
public class Exp {public static void main(String[] args) {double a = 12;System.out.println(Math.exp(a));}}
Output:
162754.79141900392
No comments:
Post a Comment