JS Built-ins
← Math111 / 215
Mathexpm1beginner

Math.expm1(0) Equals Zero

πŸ“– Usage Example
// e^x minus 1, precise for very small x
Math.expm1(0)     // β†’ 0
Math.expm1(0.001) // β†’ 0.0010005...

Use Math.expm1(x) instead of Math.exp(x) - 1 for small x values to avoid floating-point precision loss.

Math.expm1(x)

Returns eΛ£ - 1 with higher precision for small values of x. Math.expm1(0) returns 0.

Challenge: Use Math.expm1() and verify its result for input 0.

πŸ’‘ Hints (2)
  • β€’ expm1(0) = e⁰ - 1 = 1 - 1 = 0
  • β€’ expm1 is more precise than exp(x) - 1 for small x