e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \leq -0.34231484842688326:\\
\;\;\;\;e^{a \cdot x} - 1\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot x + 0.5 \cdot {\left(a \cdot x\right)}^{2}\right) + \left(0.16666666666666666 \cdot {\left(a \cdot x\right)}^{3} + 0.041666666666666664 \cdot {\left(a \cdot x\right)}^{4}\right)\\
\end{array}(FPCore (a x) :precision binary64 (- (exp (* a x)) 1.0))
(FPCore (a x)
:precision binary64
(if (<= (* a x) -0.34231484842688326)
(- (exp (* a x)) 1.0)
(+
(+ (* a x) (* 0.5 (pow (* a x) 2.0)))
(+
(* 0.16666666666666666 (pow (* a x) 3.0))
(* 0.041666666666666664 (pow (* a x) 4.0))))))double code(double a, double x) {
return exp(a * x) - 1.0;
}
double code(double a, double x) {
double tmp;
if ((a * x) <= -0.34231484842688326) {
tmp = exp(a * x) - 1.0;
} else {
tmp = ((a * x) + (0.5 * pow((a * x), 2.0))) + ((0.16666666666666666 * pow((a * x), 3.0)) + (0.041666666666666664 * pow((a * x), 4.0)));
}
return tmp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.6 |
|---|---|
| Target | 0.2 |
| Herbie | 0.3 |
if (*.f64 a x) < -0.342314848426883256Initial program 0.0
rmApplied *-un-lft-identity_binary640.0
if -0.342314848426883256 < (*.f64 a x) Initial program 44.2
Taylor expanded around 0 18.5
Simplified4.9
Taylor expanded around 0 8.6
Simplified0.5
Final simplification0.3
herbie shell --seed 2021110
(FPCore (a x)
:name "expax (section 3.5)"
:precision binary64
: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))