e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -3.56979547989466417 \cdot 10^{-7}:\\
\;\;\;\;\left(\sqrt[3]{\left(\log \left(\sqrt{\sqrt{e^{e^{a \cdot x} - 1}}}\right) + \log \left(\sqrt{\sqrt{e^{e^{a \cdot x} - 1}}}\right)\right) + \log \left(\sqrt{e^{e^{a \cdot x} - 1}}\right)} \cdot \sqrt[3]{e^{a \cdot x} - 1}\right) \cdot \sqrt[3]{e^{a \cdot x} - 1}\\
\mathbf{elif}\;a \cdot x \le 2.97473326445349939 \cdot 10^{-19}:\\
\;\;\;\;\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)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{\log \left(\sqrt{e^{e^{a \cdot x} - 1}}\right) + \left(\sqrt[3]{\log \left(\sqrt{e^{e^{a \cdot x} - 1}}\right)} \cdot \sqrt[3]{\log \left(\sqrt{e^{e^{a \cdot x} - 1}}\right)}\right) \cdot \sqrt[3]{\log \left(\sqrt{e^{e^{a \cdot x} - 1}}\right)}} \cdot \sqrt[3]{e^{a \cdot x} - 1}\right) \cdot \sqrt[3]{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) <= -3.569795479894664e-07)) {
temp = ((cbrt(((log(sqrt(sqrt(exp((exp((a * x)) - 1.0))))) + log(sqrt(sqrt(exp((exp((a * x)) - 1.0)))))) + log(sqrt(exp((exp((a * x)) - 1.0)))))) * cbrt((exp((a * x)) - 1.0))) * cbrt((exp((a * x)) - 1.0)));
} else {
double temp_1;
if (((a * x) <= 2.9747332644534994e-19)) {
temp_1 = fma(0.5, (pow(a, 2.0) * pow(x, 2.0)), fma(0.16666666666666666, (pow(a, 3.0) * pow(x, 3.0)), (a * x)));
} else {
temp_1 = ((cbrt((log(sqrt(exp((exp((a * x)) - 1.0)))) + ((cbrt(log(sqrt(exp((exp((a * x)) - 1.0))))) * cbrt(log(sqrt(exp((exp((a * x)) - 1.0)))))) * cbrt(log(sqrt(exp((exp((a * x)) - 1.0)))))))) * cbrt((exp((a * x)) - 1.0))) * cbrt((exp((a * x)) - 1.0)));
}
temp = temp_1;
}
return temp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.2 |
|---|---|
| Target | 0.2 |
| Herbie | 9.4 |
if (* a x) < -3.569795479894664e-07Initial program 0.2
rmApplied add-cube-cbrt0.2
rmApplied add-log-exp0.2
Applied add-log-exp0.2
Applied diff-log0.2
Simplified0.2
rmApplied add-sqr-sqrt0.2
Applied log-prod0.2
rmApplied add-sqr-sqrt0.2
Applied sqrt-prod0.2
Applied log-prod0.2
if -3.569795479894664e-07 < (* a x) < 2.9747332644534994e-19Initial program 45.1
Taylor expanded around 0 13.5
Simplified13.5
if 2.9747332644534994e-19 < (* a x) Initial program 25.4
rmApplied add-cube-cbrt25.5
rmApplied add-log-exp25.5
Applied add-log-exp31.7
Applied diff-log31.8
Simplified31.8
rmApplied add-sqr-sqrt31.9
Applied log-prod31.9
rmApplied add-cube-cbrt31.9
Final simplification9.4
herbie shell --seed 2020060 +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))