e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \leq -0.04069334585048068:\\
\;\;\;\;e^{a \cdot x} - 1\\
\mathbf{else}:\\
\;\;\;\;a \cdot x + a \cdot \left(x \cdot \left(a \cdot \left(x \cdot 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.04069334585048068) (- (exp (* a x)) 1.0) (+ (* a x) (* a (* x (* a (* x 0.5)))))))
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)) <= -0.04069334585048068)) {
tmp = ((double) (((double) exp(((double) (a * x)))) - 1.0));
} else {
tmp = ((double) (((double) (a * x)) + ((double) (a * ((double) (x * ((double) (a * ((double) (x * 0.5))))))))));
}
return tmp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.6 |
|---|---|
| Target | 0.2 |
| Herbie | 0.5 |
if (* a x) < -0.040693345850480678Initial program Error: 0.0 bits
if -0.040693345850480678 < (* a x) Initial program Error: 44.7 bits
Taylor expanded around 0 Error: 14.3 bits
SimplifiedError: 8.0 bits
Taylor expanded around 0 Error: 8.3 bits
SimplifiedError: 4.4 bits
rmApplied associate-*r*Error: 0.7 bits
SimplifiedError: 0.7 bits
Final simplificationError: 0.5 bits
herbie shell --seed 2020203
(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))