How to use the Math.exp() function to get the base-e exponential, e (2.7182818) raised to the power of N in JavaScript

1 Answer

0 votes
document.write("Math.exp(-1) = " + Math.exp(-1) + "<br />");
document.write("Math.exp(1) = " + Math.exp(1) + "<br />");
document.write("Math.exp(0) = " + Math.exp(0) + "<br />");
document.write("Math.exp(-0) = " + Math.exp(-0) + "<br />");
document.write("Math.exp(100) = " + Math.exp(100) + "<br />");
document.write("Math.exp(710) = " + Math.exp(710) + "<br />");
document.write("Math.exp(Infinity) = " + Math.exp(Infinity) + "<br />");
document.write("Math.exp(-Infinity) = " + Math.exp(-Infinity) + "<br />");

 
/*
run

Math.exp(-1) = 0.36787944117144233
Math.exp(1) = 2.718281828459045
Math.exp(0) = 1
Math.exp(-0) = 1
Math.exp(100) = 2.6881171418161356e+43
Math.exp(710) = Infinity
Math.exp(Infinity) = Infinity
Math.exp(-Infinity) = 0
 
*/

 



answered Aug 2, 2016 by avibootz
...