e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \leq -7.848923535993033 \cdot 10^{-11}:\\
\;\;\;\;\frac{\log \left(e^{{\left(e^{a \cdot x}\right)}^{2} + -1}\right)}{e^{a \cdot x} + 1}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(a + x \cdot \left(\left(a \cdot a\right) \cdot \left(0.5 + a \cdot \left(x \cdot 0.16666666666666666\right)\right)\right)\right)\\
\end{array}(FPCore (a x) :precision binary64 (- (exp (* a x)) 1.0))
(FPCore (a x) :precision binary64 (if (<= (* a x) -7.848923535993033e-11) (/ (log (exp (+ (pow (exp (* a x)) 2.0) -1.0))) (+ (exp (* a x)) 1.0)) (* x (+ a (* x (* (* a a) (+ 0.5 (* a (* x 0.16666666666666666)))))))))
double code(double a, double x) {
return exp(a * x) - 1.0;
}
double code(double a, double x) {
double tmp;
if ((a * x) <= -7.848923535993033e-11) {
tmp = log(exp(pow(exp(a * x), 2.0) + -1.0)) / (exp(a * x) + 1.0);
} else {
tmp = x * (a + (x * ((a * a) * (0.5 + (a * (x * 0.16666666666666666))))));
}
return tmp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.1 |
|---|---|
| Target | 0.2 |
| Herbie | 3.0 |
if (*.f64 a x) < -7.8489235359930334e-11Initial program 0.4
rmApplied flip--_binary64_14300.4
Simplified0.4
rmApplied add-log-exp_binary64_14940.4
Applied add-log-exp_binary64_14940.4
Applied sum-log_binary64_15460.4
Simplified0.4
if -7.8489235359930334e-11 < (*.f64 a x) Initial program 44.4
Taylor expanded around 0 14.2
Simplified7.6
Taylor expanded around 0 7.6
Simplified4.4
Final simplification3.0
herbie shell --seed 2020292
(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))