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




Bits error versus a




Bits error versus x
Results
| Original | 28.8 |
|---|---|
| Target | 0.2 |
| Herbie | 0.3 |
if (*.f64 a x) < -3.19888227068729051e-4Initial program 0.0
rmApplied flip--_binary64_17580.0
if -3.19888227068729051e-4 < (*.f64 a x) Initial program 43.9
Taylor expanded around 0 14.2
Simplified4.0
Taylor expanded around 0 14.2
Simplified0.4
Final simplification0.3
herbie shell --seed 2021044
(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))