e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -4.57004817984858424 \cdot 10^{-12}:\\
\;\;\;\;\left(\left(\sqrt[3]{e^{a \cdot x} - 1} \cdot \sqrt[3]{\sqrt{e^{a \cdot x}} + \sqrt{1}}\right) \cdot \sqrt[3]{\sqrt{e^{a \cdot x}} - \sqrt{1}}\right) \cdot \sqrt[3]{\log \left(e^{e^{a \cdot x} - 1}\right)}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{2}, {a}^{2} \cdot {x}^{2}, \mathsf{fma}\left(\frac{1}{6}, {a}^{3} \cdot {x}^{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) <= -4.570048179848584e-12)) {
VAR = (((cbrt((exp((a * x)) - 1.0)) * cbrt((sqrt(exp((a * x))) + sqrt(1.0)))) * cbrt((sqrt(exp((a * x))) - sqrt(1.0)))) * cbrt(log(exp((exp((a * x)) - 1.0)))));
} else {
VAR = fma(0.5, (pow(a, 2.0) * pow(x, 2.0)), fma(0.16666666666666666, (pow(a, 3.0) * pow(x, 3.0)), (a * x)));
}
return VAR;
}




Bits error versus a




Bits error versus x
Results
| Original | 28.9 |
|---|---|
| Target | 0.2 |
| Herbie | 8.9 |
if (* a x) < -4.570048179848584e-12Initial program 0.5
rmApplied add-cube-cbrt0.5
rmApplied add-sqr-sqrt0.5
Applied add-sqr-sqrt0.5
Applied difference-of-squares0.5
Applied cbrt-prod0.5
Applied associate-*r*0.5
rmApplied add-log-exp0.5
Applied add-log-exp0.5
Applied diff-log0.5
Simplified0.5
if -4.570048179848584e-12 < (* a x) Initial program 43.6
Taylor expanded around 0 13.2
Simplified13.2
Final simplification8.9
herbie shell --seed 2020091 +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))