The Taylor series of eˣ fails at x = −20
Terms reach for an answer of , so the sum is off by more than 10%; is good to .
|x^k / k!|rounding error of the largest termthe answer, exp(-20)
| Quantity | Viv | Checked by |
|---|---|---|
largest term | 4.30998 × 107 | the largest term is about 4.3e7 |
rel err direct | 1.72754 | the series at x = -20 is off by more than 10% |
rel err reciprocal | 2.0066 × 10−16 | 1 / exp(20) by the same series is good to 1e-14 |
exp_series_cancellation.viv
Output · native build · Oct 14, 2026 · 0.52 s
exp_minus_20: 2.06115e-09 largest_term: 4.30998e+07 rel_err_direct: 1.72754 rel_err_reciprocal: 2.0066e-16
- ✓ the largest term is about 4.3e7
- ✓ the series at x = -20 is off by more than 10%
- ✓ 1 / exp(20) by the same series is good to 1e-14
Open in the workbenchAtlasMore math claims
- Full statement
- Summing the Taylor series of at term by term in double precision gives a relative error above 0.1 (the largest term is about and the answer about ), while by the same series has a relative error below .
- Scope
- The series is summed left to right until the terms stop changing the sum, about 100 terms. The error depends on rounding in the largest terms, so its exact size is not claimed, only that it exceeds 10% here.
- Reference
- from the libm exp (correctly rounded to within an ulp); Forsythe, Malcolm and Moler, Computer Methods for Mathematical Computations (1977), section 1.3, the textbook example.
claims/math/exp_series_cancellation.viv#1d1dae8887