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




Bits error versus a




Bits error versus x
Results
| Original | 29.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.5 |
if (*.f64 a x) < -4.5898218916979556e-6Initial program 0.1
rmApplied add-sqr-sqrt_binary640.1
Applied add-sqr-sqrt_binary640.1
Applied difference-of-squares_binary640.1
Simplified0.1
Simplified0.1
if -4.5898218916979556e-6 < (*.f64 a x) Initial program 44.4
Taylor expanded around 0 14.6
Simplified7.8
Taylor expanded around 0 8.6
Simplified8.6
rmApplied pow2_binary648.6
Applied pow2_binary648.6
Applied pow-prod-down_binary640.7
Final simplification0.5
herbie shell --seed 2020220
(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))