e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \leq -0.029419775113239822:\\
\;\;\;\;\frac{e^{a \cdot x} \cdot e^{a \cdot x} - 1}{e^{a \cdot x} + 1}\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot x + 0.5 \cdot {\left(a \cdot x\right)}^{2}\right) + 0.16666666666666666 \cdot {\left(a \cdot x\right)}^{3}\\
\end{array}(FPCore (a x) :precision binary64 (- (exp (* a x)) 1.0))
(FPCore (a x)
:precision binary64
(if (<= (* a x) -0.029419775113239822)
(/ (- (* (exp (* a x)) (exp (* a x))) 1.0) (+ (exp (* a x)) 1.0))
(+
(+ (* a x) (* 0.5 (pow (* a x) 2.0)))
(* 0.16666666666666666 (pow (* a x) 3.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.029419775113239822) {
tmp = ((exp(a * x) * exp(a * x)) - 1.0) / (exp(a * x) + 1.0);
} else {
tmp = ((a * x) + (0.5 * pow((a * x), 2.0))) + (0.16666666666666666 * pow((a * x), 3.0));
}
return tmp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.3 |
if (*.f64 a x) < -0.029419775113239822Initial program 0.0
rmApplied flip--_binary64_17580.0
if -0.029419775113239822 < (*.f64 a x) Initial program 44.4
Taylor expanded around 0 14.5
Simplified4.7
Taylor expanded around 0 8.2
Simplified0.5
Final simplification0.3
herbie shell --seed 2021019
(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))