e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \leq -0.479210517566234:\\
\;\;\;\;\frac{{\left(e^{a \cdot x}\right)}^{3} - 1}{1 + e^{a \cdot x} \cdot \left(e^{a \cdot x} + 1\right)}\\
\mathbf{elif}\;a \cdot x \leq -1.7204624062132057 \cdot 10^{-26} \lor \neg \left(a \cdot x \leq -5.483842767516583 \cdot 10^{-60}\right):\\
\;\;\;\;x \cdot \left(a + x \cdot \left(\left(a \cdot a\right) \cdot \left(0.5 + a \cdot \left(x \cdot 0.16666666666666666\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(a + \log \left({\left(e^{x}\right)}^{\left(\left(a \cdot a\right) \cdot \left(0.5 + a \cdot \left(x \cdot 0.16666666666666666\right)\right)\right)}\right)\right)\\
\end{array}(FPCore (a x) :precision binary64 (- (exp (* a x)) 1.0))
(FPCore (a x)
:precision binary64
(if (<= (* a x) -0.479210517566234)
(/
(- (pow (exp (* a x)) 3.0) 1.0)
(+ 1.0 (* (exp (* a x)) (+ (exp (* a x)) 1.0))))
(if (or (<= (* a x) -1.7204624062132057e-26)
(not (<= (* a x) -5.483842767516583e-60)))
(* x (+ a (* x (* (* a a) (+ 0.5 (* a (* x 0.16666666666666666)))))))
(*
x
(+
a
(log
(pow (exp x) (* (* a a) (+ 0.5 (* a (* x 0.16666666666666666)))))))))))double code(double a, double x) {
return exp(a * x) - 1.0;
}
double code(double a, double x) {
double tmp;
if ((a * x) <= -0.479210517566234) {
tmp = (pow(exp(a * x), 3.0) - 1.0) / (1.0 + (exp(a * x) * (exp(a * x) + 1.0)));
} else if (((a * x) <= -1.7204624062132057e-26) || !((a * x) <= -5.483842767516583e-60)) {
tmp = x * (a + (x * ((a * a) * (0.5 + (a * (x * 0.16666666666666666))))));
} else {
tmp = x * (a + log(pow(exp(x), ((a * a) * (0.5 + (a * (x * 0.16666666666666666)))))));
}
return tmp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.0 |
|---|---|
| Target | 0.2 |
| Herbie | 3.1 |
if (*.f64 a x) < -0.47921051756623401Initial program 0.0
rmApplied flip3--_binary640.0
Simplified0.0
Simplified0.0
if -0.47921051756623401 < (*.f64 a x) < -1.72046240621320574e-26 or -5.48384276751658254e-60 < (*.f64 a x) Initial program 42.6
Taylor expanded around 0 13.1
Simplified7.0
Taylor expanded around 0 7.0
Simplified4.2
if -1.72046240621320574e-26 < (*.f64 a x) < -5.48384276751658254e-60Initial program 61.8
Taylor expanded around 0 34.8
Simplified16.2
rmApplied add-log-exp_binary6422.5
Simplified14.8
Final simplification3.1
herbie shell --seed 2020233
(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))