e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \leq -0.08386209981862915:\\
\;\;\;\;\frac{{\left(e^{a \cdot x}\right)}^{3} - 1}{e^{a \cdot x} \cdot e^{a \cdot x} + \left(e^{a \cdot x} + 1\right)}\\
\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) -0.08386209981862915)
(/
(- (pow (exp (* a x)) 3.0) 1.0)
(+ (* (exp (* a x)) (exp (* a x))) (+ (exp (* a x)) 1.0)))
(+ (* a x) (* 0.5 (pow (* a x) 2.0)))))double code(double a, double x) {
return exp(a * x) - 1.0;
}
double code(double a, double x) {
double tmp;
if ((a * x) <= -0.08386209981862915) {
tmp = (pow(exp(a * x), 3.0) - 1.0) / ((exp(a * x) * exp(a * x)) + (exp(a * x) + 1.0));
} else {
tmp = (a * x) + (0.5 * pow((a * x), 2.0));
}
return tmp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.7 |
|---|---|
| Target | 0.2 |
| Herbie | 0.5 |
if (*.f64 a x) < -0.0838620998186291461Initial program 0.0
rmApplied flip3--_binary64_14460.0
if -0.0838620998186291461 < (*.f64 a x) Initial program 44.6
Taylor expanded around 0 8.5
Simplified4.7
rmApplied associate-*r*_binary64_13820.8
rmApplied distribute-rgt-in_binary64_13920.8
Simplified0.8
Simplified0.8
Taylor expanded around 0 8.5
Simplified0.8
Final simplification0.5
herbie shell --seed 2021015
(FPCore (a x)
:name "expax (section 3.5)"
:precision binary64
: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))