e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -4.1023891212148034 \cdot 10^{-4}:\\
\;\;\;\;\left(\sqrt{e^{a \cdot x}} + \sqrt{1}\right) \cdot \left(\sqrt{e^{a \cdot x}} - \sqrt{1}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{6}, {\left(x \cdot a\right)}^{3}, \mathsf{fma}\left(\frac{1}{2}, {\left(x \cdot a\right)}^{2}, x \cdot a\right)\right)\\
\end{array}double code(double a, double x) {
return (exp((a * x)) - 1.0);
}
double code(double a, double x) {
double temp;
if (((a * x) <= -0.00041023891212148034)) {
temp = ((sqrt(exp((a * x))) + sqrt(1.0)) * (sqrt(exp((a * x))) - sqrt(1.0)));
} else {
temp = fma(0.16666666666666666, pow((x * a), 3.0), fma(0.5, pow((x * a), 2.0), (x * a)));
}
return temp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.8 |
|---|---|
| Target | 0.2 |
| Herbie | 0.3 |
if (* a x) < -0.00041023891212148034Initial program 0.0
rmApplied add-sqr-sqrt0.0
Applied add-sqr-sqrt0.0
Applied difference-of-squares0.0
if -0.00041023891212148034 < (* a x) Initial program 44.8
Taylor expanded around 0 14.6
Simplified14.6
rmApplied pow-prod-down8.6
Simplified8.6
Taylor expanded around inf 14.6
Simplified0.4
Final simplification0.3
herbie shell --seed 2020065 +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))