Average Error: 32.2 → 12.1
Time: 20.3s
Precision: 64
Internal precision: 1408
\[e^{a \cdot x} - 1\]
⬇
\[\begin{array}{l}
\mathbf{if}\;a \cdot x \le -5.093462692759953 \cdot 10^{-15}:\\
\;\;\;\;\log \left(e^{\frac{{\left(e^{a \cdot x}\right)}^2 - {1}^2}{e^{a \cdot x} + 1}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{6} \cdot \left({a}^{3} \cdot {x}^{3}\right) + \left(\frac{1}{2} \cdot \left({a}^2 \cdot {x}^2\right) + a \cdot x\right)\\
\end{array}\]
Derivation
- Split input into 2 regimes.
-
if (* a x) < -5.093462692759953e-15
Initial program 0.9
\[e^{a \cdot x} - 1\]
- Using strategy
rm
Applied add-log-exp 0.9
\[\leadsto \color{blue}{\log \left(e^{e^{a \cdot x} - 1}\right)}\]
- Using strategy
rm
Applied flip-- 0.9
\[\leadsto \log \left(e^{\color{blue}{\frac{{\left(e^{a \cdot x}\right)}^2 - {1}^2}{e^{a \cdot x} + 1}}}\right)\]
if -5.093462692759953e-15 < (* a x)
Initial program 46.6
\[e^{a \cdot x} - 1\]
Applied taylor 17.3
\[\leadsto \frac{1}{6} \cdot \left({a}^{3} \cdot {x}^{3}\right) + \left(\frac{1}{2} \cdot \left({a}^2 \cdot {x}^2\right) + a \cdot x\right)\]
Taylor expanded around 0 17.3
\[\leadsto \color{blue}{\frac{1}{6} \cdot \left({a}^{3} \cdot {x}^{3}\right) + \left(\frac{1}{2} \cdot \left({a}^2 \cdot {x}^2\right) + a \cdot x\right)}\]
- Recombined 2 regimes into one program.
- Removed slow pow expressions
Runtime
Please include this information when filing a bug report:
herbie shell --seed '#(3052192724 3812927732 3686175817 630908657 2373248591 511094450)'
(FPCore (a x)
:name "NMSE section 3.5"
(- (exp (* a x)) 1))