e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \leq -1.2065385524619287 \cdot 10^{-05}:\\
\;\;\;\;\sqrt[3]{e^{a \cdot x}} \cdot \left(\sqrt[3]{e^{a \cdot x}} \cdot \sqrt[3]{e^{a \cdot x}}\right) - 1\\
\mathbf{else}:\\
\;\;\;\;a \cdot x + 0.5 \cdot {\left(a \cdot x\right)}^{2}\\
\end{array}(FPCore (a x) :precision binary64 (- (exp (* a x)) 1.0))
(FPCore (a x)
:precision binary64
(if (<= (* a x) -1.2065385524619287e-05)
(-
(* (cbrt (exp (* a x))) (* (cbrt (exp (* a x))) (cbrt (exp (* a x)))))
1.0)
(+ (* a x) (* 0.5 (pow (* a x) 2.0)))))double code(double a, double x) {
return ((double) (((double) exp(((double) (a * x)))) - 1.0));
}
double code(double a, double x) {
double tmp;
if ((((double) (a * x)) <= -1.2065385524619287e-05)) {
tmp = ((double) (((double) (((double) cbrt(((double) exp(((double) (a * x)))))) * ((double) (((double) cbrt(((double) exp(((double) (a * x)))))) * ((double) cbrt(((double) exp(((double) (a * x)))))))))) - 1.0));
} else {
tmp = ((double) (((double) (a * x)) + ((double) (0.5 * ((double) pow(((double) (a * x)), 2.0))))));
}
return tmp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.0 |
|---|---|
| Target | 0.1 |
| Herbie | 0.4 |
if (* a x) < -1.20653855246192871e-5Initial program Error: 0.1 bits
rmApplied add-cube-cbrtError: 0.1 bits
if -1.20653855246192871e-5 < (* a x) Initial program Error: 44.2 bits
Taylor expanded around 0 Error: 13.6 bits
SimplifiedError: 7.3 bits
Taylor expanded around 0 Error: 7.9 bits
SimplifiedError: 7.9 bits
rmApplied pow2Error: 7.9 bits
Applied pow2Error: 7.9 bits
Applied pow-prod-downError: 0.5 bits
Final simplificationError: 0.4 bits
herbie shell --seed 2020205
(FPCore (a x)
:name "expax (section 3.5)"
:precision binary64
:herbie-expected 14
:herbie-target
(if (< (fabs (* a x)) 0.1) (* (* a x) (+ 1.0 (+ (/ (* a x) 2.0) (/ (pow (* a x) 2.0) 6.0)))) (- (exp (* a x)) 1.0))
(- (exp (* a x)) 1.0))