e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -5.8466223410137292:\\
\;\;\;\;\left(\sqrt[3]{e^{a \cdot x}} \cdot \sqrt[3]{e^{a \cdot x}}\right) \cdot \sqrt[3]{e^{a \cdot x}} - 1\\
\mathbf{elif}\;a \cdot x \le 8.9719548727940208 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{2}, {\left(x \cdot a\right)}^{2}, x \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{e^{a \cdot x} - 1} \cdot \sqrt{e^{a \cdot x} - 1}\\
\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) <= -5.846622341013729)) {
temp = (((cbrt(exp((a * x))) * cbrt(exp((a * x)))) * cbrt(exp((a * x)))) - 1.0);
} else {
double temp_1;
if (((a * x) <= 8.971954872794021e-08)) {
temp_1 = fma(0.5, pow((x * a), 2.0), (x * a));
} else {
temp_1 = (sqrt((exp((a * x)) - 1.0)) * sqrt((exp((a * x)) - 1.0)));
}
temp = temp_1;
}
return temp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.4 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if (* a x) < -5.846622341013729Initial program 0
rmApplied add-cube-cbrt0
if -5.846622341013729 < (* a x) < 8.971954872794021e-08Initial program 44.5
Taylor expanded around 0 14.0
Simplified14.0
Taylor expanded around 0 7.9
Simplified7.9
rmApplied pow-prod-down0.5
Simplified0.5
if 8.971954872794021e-08 < (* a x) Initial program 7.6
rmApplied add-sqr-sqrt7.6
Final simplification0.4
herbie shell --seed 2020049 +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))