e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \leq -9.859809998267145 \cdot 10^{-08}:\\
\;\;\;\;\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 -2.206613079296664 \cdot 10^{-73}:\\
\;\;\;\;x \cdot \left(a + x \cdot \left(0.5 \cdot \left(a \cdot a\right)\right)\right)\\
\mathbf{elif}\;a \cdot x \leq 2.3830218440335053 \cdot 10^{-64}:\\
\;\;\;\;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) -9.859809998267145e-08)
(/
(- (pow (exp (* a x)) 3.0) 1.0)
(+ 1.0 (* (exp (* a x)) (+ (exp (* a x)) 1.0))))
(if (<= (* a x) -2.206613079296664e-73)
(* x (+ a (* x (* 0.5 (* a a)))))
(if (<= (* a x) 2.3830218440335053e-64)
(*
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 exp(a * x) - 1.0;
}
double code(double a, double x) {
double tmp;
if ((a * x) <= -9.859809998267145e-08) {
tmp = (pow(exp(a * x), 3.0) - 1.0) / (1.0 + (exp(a * x) * (exp(a * x) + 1.0)));
} else if ((a * x) <= -2.206613079296664e-73) {
tmp = x * (a + (x * (0.5 * (a * a))));
} else if ((a * x) <= 2.3830218440335053e-64) {
tmp = x * (a + log(pow(exp(x), ((a * a) * (0.5 + (a * (x * 0.16666666666666666)))))));
} else {
tmp = x * (a + (x * ((a * a) * (0.5 + (a * (x * 0.16666666666666666))))));
}
return tmp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.8 |
|---|---|
| Target | 0.2 |
| Herbie | 2.9 |
if (*.f64 a x) < -9.85980999826714522e-8Initial program 0.2
rmApplied flip3--_binary64_14460.2
Simplified0.2
Simplified0.2
if -9.85980999826714522e-8 < (*.f64 a x) < -2.20661307929666384e-73Initial program 57.9
Taylor expanded around 0 33.2
Simplified17.6
Taylor expanded around 0 21.8
Simplified11.7
if -2.20661307929666384e-73 < (*.f64 a x) < 2.38302184403350533e-64Initial program 42.2
Taylor expanded around 0 7.8
Simplified3.9
rmApplied add-log-exp_binary64_14814.1
Simplified1.8
if 2.38302184403350533e-64 < (*.f64 a x) Initial program 48.4
Taylor expanded around 0 40.6
Simplified23.0
Taylor expanded around 0 23.0
Simplified16.4
Final simplification2.9
herbie shell --seed 2020343
(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))