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




Bits error versus a




Bits error versus x
Results
| Original | 29.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.5 |
if (*.f64 a x) < -0.0557000885261277542Initial program 0.0
rmApplied flip--_binary64_7350.0
Simplified0.0
if -0.0557000885261277542 < (*.f64 a x) Initial program 43.7
Taylor expanded around 0 8.1
Simplified4.7
rmApplied associate-*r*_binary64_7000.8
Final simplification0.5
herbie shell --seed 2021040
(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))