e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \leq -0.0006823369320874611:\\
\;\;\;\;\frac{{\left(e^{a \cdot x}\right)}^{2} + -1}{e^{a \cdot x} + 1}\\
\mathbf{elif}\;a \cdot x \leq -2.7244183453437766 \cdot 10^{-112}:\\
\;\;\;\;x \cdot \left(a + \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{\sqrt[3]{x} \cdot \left(\left(a \cdot a\right) \cdot \left(a \cdot \left(x \cdot 0.16666666666666666\right) + 0.5\right)\right)} \cdot \left(\frac{\sqrt[3]{\sqrt[3]{x} \cdot \left(\left(a \cdot a\right) \cdot \left(0.125 + {\left(a \cdot \left(x \cdot 0.16666666666666666\right)\right)}^{3}\right)\right)}}{\sqrt[3]{0.25 + a \cdot \left(\left(x \cdot 0.16666666666666666\right) \cdot \left(a \cdot \left(x \cdot 0.16666666666666666\right) + -0.5\right)\right)}} \cdot \sqrt[3]{\sqrt[3]{x} \cdot \left(\left(a \cdot a\right) \cdot \left(a \cdot \left(x \cdot 0.16666666666666666\right) + 0.5\right)\right)}\right)\right)\right)\\
\mathbf{elif}\;a \cdot x \leq 6.054821837814354 \cdot 10^{-57}:\\
\;\;\;\;x \cdot \left(a + \log \left({\left(e^{x}\right)}^{\left(\left(a \cdot a\right) \cdot \left(a \cdot \left(x \cdot 0.16666666666666666\right) + 0.5\right)\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(a + x \cdot e^{\log \left(\left(a \cdot a\right) \cdot \left(a \cdot \left(x \cdot 0.16666666666666666\right) + 0.5\right)\right)}\right)\\
\end{array}(FPCore (a x) :precision binary64 (- (exp (* a x)) 1.0))
(FPCore (a x)
:precision binary64
(if (<= (* a x) -0.0006823369320874611)
(/ (+ (pow (exp (* a x)) 2.0) -1.0) (+ (exp (* a x)) 1.0))
(if (<= (* a x) -2.7244183453437766e-112)
(*
x
(+
a
(*
(* (cbrt x) (cbrt x))
(*
(cbrt
(* (cbrt x) (* (* a a) (+ (* a (* x 0.16666666666666666)) 0.5))))
(*
(/
(cbrt
(*
(cbrt x)
(* (* a a) (+ 0.125 (pow (* a (* x 0.16666666666666666)) 3.0)))))
(cbrt
(+
0.25
(*
a
(*
(* x 0.16666666666666666)
(+ (* a (* x 0.16666666666666666)) -0.5))))))
(cbrt
(*
(cbrt x)
(* (* a a) (+ (* a (* x 0.16666666666666666)) 0.5)))))))))
(if (<= (* a x) 6.054821837814354e-57)
(*
x
(+
a
(log
(pow (exp x) (* (* a a) (+ (* a (* x 0.16666666666666666)) 0.5))))))
(*
x
(+
a
(*
x
(exp
(log (* (* a a) (+ (* a (* x 0.16666666666666666)) 0.5)))))))))))double code(double a, double x) {
return exp(a * x) - 1.0;
}
double code(double a, double x) {
double tmp;
if ((a * x) <= -0.0006823369320874611) {
tmp = (pow(exp(a * x), 2.0) + -1.0) / (exp(a * x) + 1.0);
} else if ((a * x) <= -2.7244183453437766e-112) {
tmp = x * (a + ((cbrt(x) * cbrt(x)) * (cbrt(cbrt(x) * ((a * a) * ((a * (x * 0.16666666666666666)) + 0.5))) * ((cbrt(cbrt(x) * ((a * a) * (0.125 + pow((a * (x * 0.16666666666666666)), 3.0)))) / cbrt(0.25 + (a * ((x * 0.16666666666666666) * ((a * (x * 0.16666666666666666)) + -0.5))))) * cbrt(cbrt(x) * ((a * a) * ((a * (x * 0.16666666666666666)) + 0.5)))))));
} else if ((a * x) <= 6.054821837814354e-57) {
tmp = x * (a + log(pow(exp(x), ((a * a) * ((a * (x * 0.16666666666666666)) + 0.5)))));
} else {
tmp = x * (a + (x * exp(log((a * a) * ((a * (x * 0.16666666666666666)) + 0.5)))));
}
return tmp;
}










Bits error versus a










Bits error versus x
Results
| Original | 29.6 |
|---|---|
| Target | 0.2 |
| Herbie | 3.0 |
| Alternative 1 | |
|---|---|
| Accuracy | 3.0 |
| Cost | 1537 |
| Alternative 2 | |
|---|---|
| Accuracy | 3.0 |
| Cost | 1793 |
| Alternative 3 | |
|---|---|
| Accuracy | 3.0 |
| Cost | 5185 |
| Alternative 4 | |
|---|---|
| Accuracy | 3.0 |
| Cost | 5185 |
| Alternative 5 | |
|---|---|
| Accuracy | 24.0 |
| Cost | 4864 |
| Alternative 6 | |
|---|---|
| Accuracy | 24.6 |
| Cost | 3584 |
if (*.f64 a x) < -6.82336932087461109e-4Initial program 0.0
rmApplied flip--_binary64_14170.0
Simplified0.0
if -6.82336932087461109e-4 < (*.f64 a x) < -2.7244183453437766e-112Initial program 57.8
Taylor expanded around 0 32.7
Simplified17.4
rmApplied add-cube-cbrt_binary64_147717.4
Applied associate-*l*_binary64_138317.4
Simplified11.9
rmApplied add-cube-cbrt_binary64_147711.9
Simplified11.9
Simplified11.9
rmApplied flip3-+_binary64_144511.9
Applied associate-*r/_binary64_138411.9
Applied associate-*r/_binary64_138411.9
Applied cbrt-div_binary64_147411.9
Simplified11.9
Simplified11.9
if -2.7244183453437766e-112 < (*.f64 a x) < 6.05482183781435401e-57Initial program 40.8
Taylor expanded around 0 7.3
Simplified3.8
rmApplied add-log-exp_binary64_14814.0
Simplified1.4
if 6.05482183781435401e-57 < (*.f64 a x) Initial program 48.8
Taylor expanded around 0 40.5
Simplified23.4
rmApplied add-exp-log_binary64_148023.4
Simplified17.1
Final simplification3.0
herbie shell --seed 2020322
(FPCore (a x)
:name "expax (section 3.5)"
:precision binary64
:herbie-expected 14
:herbie-target
(if (< (fabs (* a x)) 0.1) (* (* a x) (+ 1.0 (+ (/ (* a x) 2.0) (/ (pow (* a x) 2.0) 6.0)))) (- (exp (* a x)) 1.0))
(- (exp (* a x)) 1.0))