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




Bits error versus a




Bits error versus x
Results
| Original | 29.5 |
|---|---|
| Target | 0.1 |
| Herbie | 4.7 |
if (*.f64 a x) < -5.5194703688564379e-7Initial program 0.2
rmApplied flip--_binary640.2
Simplified0.2
if -5.5194703688564379e-7 < (*.f64 a x) Initial program 44.3
Taylor expanded around 0 13.4
Simplified7.1
Final simplification4.7
herbie shell --seed 2020224
(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))