e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -0.369328679075431043:\\
\;\;\;\;e^{a \cdot x} - 1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{2}, \left(x \cdot a\right) \cdot \left(x \cdot a\right), \mathsf{fma}\left(\frac{1}{6}, {\left(x \cdot a\right)}^{3}, a \cdot x\right)\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) <= -0.36932867907543104)) {
VAR = (exp((a * x)) - 1.0);
} else {
VAR = fma(0.5, ((x * a) * (x * a)), fma(0.16666666666666666, pow((x * a), 3.0), (a * x)));
}
return VAR;
}




Bits error versus a




Bits error versus x
Results
| Original | 28.9 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if (* a x) < -0.36932867907543104Initial program 0.0
if -0.36932867907543104 < (* a x) Initial program 43.8
Taylor expanded around 0 14.6
Simplified14.6
rmApplied pow-prod-down8.4
Simplified8.4
rmApplied unpow28.4
Applied unpow28.4
Applied unswap-sqr0.7
Simplified0.7
Simplified0.7
Final simplification0.4
herbie shell --seed 2020078 +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))