e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \leq -5.561162085756807 \cdot 10^{-05}:\\
\;\;\;\;\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.1504508473033879 \cdot 10^{-117} \lor \neg \left(a \cdot x \leq 2.3306237093067895 \cdot 10^{-55}\right):\\
\;\;\;\;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)\\
\mathbf{else}:\\
\;\;\;\;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)\\
\end{array}(FPCore (a x) :precision binary64 (- (exp (* a x)) 1.0))
(FPCore (a x)
:precision binary64
(if (<= (* a x) -5.561162085756807e-05)
(/
(- (pow (exp (* a x)) 3.0) 1.0)
(+ 1.0 (* (exp (* a x)) (+ (exp (* a x)) 1.0))))
(if (or (<= (* a x) -1.1504508473033879e-117)
(not (<= (* a x) 2.3306237093067895e-55)))
(*
x
(+
a
(log
(pow (exp x) (* (* a a) (+ 0.5 (* a (* x 0.16666666666666666))))))))
(* x (+ a (* x (* (* a a) (+ 0.5 (* a (* x 0.16666666666666666))))))))))double code(double a, double x) {
return ((double) (((double) exp(((double) (a * x)))) - 1.0));
}
double code(double a, double x) {
double tmp;
if ((((double) (a * x)) <= -5.561162085756807e-05)) {
tmp = (((double) (((double) pow(((double) exp(((double) (a * x)))), 3.0)) - 1.0)) / ((double) (1.0 + ((double) (((double) exp(((double) (a * x)))) * ((double) (((double) exp(((double) (a * x)))) + 1.0)))))));
} else {
double tmp_1;
if (((((double) (a * x)) <= -1.1504508473033879e-117) || !(((double) (a * x)) <= 2.3306237093067895e-55))) {
tmp_1 = ((double) (x * ((double) (a + ((double) log(((double) pow(((double) exp(x)), ((double) (((double) (a * a)) * ((double) (0.5 + ((double) (a * ((double) (x * 0.16666666666666666))))))))))))))));
} else {
tmp_1 = ((double) (x * ((double) (a + ((double) (x * ((double) (((double) (a * a)) * ((double) (0.5 + ((double) (a * ((double) (x * 0.16666666666666666))))))))))))));
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.4 |
|---|---|
| Target | 0.1 |
| Herbie | 3.4 |
if (*.f64 a x) < -5.5611620857568068e-5Initial program 0.1
rmApplied flip3--_binary640.1
Simplified0.1
Simplified0.1
if -5.5611620857568068e-5 < (*.f64 a x) < -1.1504508473033879e-117 or 2.33062370930678952e-55 < (*.f64 a x) Initial program 54.5
Taylor expanded around 0 37.1
Simplified20.5
rmApplied add-log-exp_binary6426.2
Simplified15.9
if -1.1504508473033879e-117 < (*.f64 a x) < 2.33062370930678952e-55Initial program 41.2
Taylor expanded around 0 7.3
Simplified3.9
Taylor expanded around 0 5.2
Simplified1.4
Final simplification3.4
herbie shell --seed 2020219
(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))