e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -3.55569637749741916 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(\sqrt{e^{a \cdot x}}, \sqrt{e^{a \cdot x}}, -1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{2}, {\left(x \cdot a\right)}^{2}, a \cdot x\right)\\
\end{array}double code(double a, double x) {
return (exp((a * x)) - 1.0);
}
double code(double a, double x) {
double VAR;
if (((a * x) <= -3.555696377497419e-05)) {
VAR = fma(sqrt(exp((a * x))), sqrt(exp((a * x))), -1.0);
} else {
VAR = fma(0.5, pow((x * a), 2.0), (a * x));
}
return VAR;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if (* a x) < -3.555696377497419e-05Initial program 0.1
rmApplied add-sqr-sqrt0.1
Applied fma-neg0.1
if -3.555696377497419e-05 < (* a x) Initial program 44.4
Taylor expanded around 0 14.0
Simplified14.0
Taylor expanded around 0 8.0
Simplified8.0
rmApplied pow-prod-down0.6
Simplified0.6
Final simplification0.4
herbie shell --seed 2020105 +o rules:numerics
(FPCore (a x)
:name "expax (section 3.5)"
:precision binary64
:herbie-expected 14
:herbie-target
(if (< (fabs (* a x)) 0.1) (* (* a x) (+ 1 (+ (/ (* a x) 2) (/ (pow (* a x) 2) 6)))) (- (exp (* a x)) 1))
(- (exp (* a x)) 1))