Average Error: 58.9 → 0.0
Time: 5.7s
Precision: 64
Internal precision: 1408
\[e^{x} - 1\]
⬇
\[\begin{array}{l}
\mathbf{if}\;x \le 0.12609879998858392:\\
\;\;\;\;{x}^2 \cdot \left(\frac{1}{2} + x \cdot \frac{1}{6}\right) + x\\
\mathbf{else}:\\
\;\;\;\;e^{x} - 1\\
\end{array}\]
Target
| Original | 58.9 |
| Comparison | 0.4 |
| Herbie | 0.0 |
\[ x \cdot \left(\left(1 + \frac{x}{2}\right) + \frac{{x}^2}{6}\right) \]
Derivation
- Split input into 2 regimes.
-
if x < 0.12609879998858392
Initial program 59.3
\[e^{x} - 1\]
Applied taylor 0.0
\[\leadsto \frac{1}{2} \cdot {x}^2 + \left(\frac{1}{6} \cdot {x}^{3} + x\right)\]
Taylor expanded around 0 0.0
\[\leadsto \color{blue}{\frac{1}{2} \cdot {x}^2 + \left(\frac{1}{6} \cdot {x}^{3} + x\right)}\]
Applied simplify 0
\[\leadsto \color{blue}{{x}^2 \cdot \left(\frac{1}{2} + x \cdot \frac{1}{6}\right) + x}\]
if 0.12609879998858392 < x
Initial program 0.3
\[e^{x} - 1\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie shell --seed '#(1067488128 1186562765 67428877 2948030040 4169093828 3206893112)'
(FPCore (x)
:name "expm1 (example 3.7)"
:pre (< -0.00017 x)
:target
(* x (+ (+ 1 (/ x 2)) (/ (sqr x) 6)))
(- (exp x) 1))