JavaScript Math.exp()

Math.exp(x) returns Euler's number e raised to the power x. In mathematical notation, it calculates ex.

console.log(Math.exp(1)); // 2.718281828459045
console.log(Math.exp(2)); // 7.38905609893065

Math.exp() syntax Top ↑

Math.exp(x)

Positive exponents Top ↑

console.log(Math.exp(2));    // 7.38905609893065
console.log(Math.exp(0.25)); // 1.2840254166877414

Negative exponents Top ↑

console.log(Math.exp(-2));   // 0.1353352832366127
console.log(Math.exp(-0.46)); // about 0.6312836455

Math.exp(0) Top ↑

console.log(Math.exp(0)); // 1

Math.exp(), Math.E and Math.pow() Top ↑

console.log(Math.exp(3));
console.log(Math.pow(Math.E, 3));
console.log(Math.E ** 3);

All three express the same mathematical idea, though floating-point representation may affect the last digits.

Math.exp() and Math.log() are inverse operations Top ↑

const x = 2.5;
console.log(Math.log(Math.exp(x))); // approximately 2.5

Math.log()




Subscribe to our YouTube Channel here



plus2net.com










We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
©2000-2026   plus2net.com   All rights reserved worldwide Privacy Policy Disclaimer