Compute Natural Exponential - 1 in JavaScript

Posted by yhuang
Public (Editable by Users)
JavaScript
None
Edit
console.log(Math.expm1(0));
// expected output: 0

console.log(Math.expm1(1));
// expected output: 1.718281828459045

console.log(Math.expm1(-1));
// expected output: -0.6321205588285577

console.log(Math.expm1(2));
// expected output: 6.38905609893065

Math.expm1(-1); // -0.6321205588285577 
Math.expm1(0);  // 0
Math.expm1(1);  // 1.718281828459045