How to use exp() the to get the base-e exponential, e (2.7183) raised to the power of double number in Java

1 Answer

0 votes
package javaapplication1;

public class JavaApplication1 {
 
    public static void main(String[] args) {
        
        double d1 = 3.14;
        double d2 = 7.899;

        System.out.printf("e = %.4f%n", Math.E);
        System.out.printf("exp(%.3f) = %.3f%n", d1, Math.exp(d1)); // double exp(double d)
        System.out.printf("exp(%.3f) = %.3f%n", d2, Math.exp(d2)); // double exp(double d)
    }
}
 
/*
run:

e = 2.7183
exp(3.140) = 23.104
exp(7.899) = 2694.586
 
*/

 



answered Sep 8, 2016 by avibootz
...