e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \leq -0.05266943121646845:\\
\;\;\;\;\left(1 + \sqrt{e^{a \cdot x}}\right) \cdot \left(\sqrt{e^{a \cdot x}} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(x + \left(x \cdot \left(a \cdot x\right)\right) \cdot 0.5\right)\\
\end{array}(FPCore (a x) :precision binary64 (- (exp (* a x)) 1.0))
(FPCore (a x) :precision binary64 (if (<= (* a x) -0.05266943121646845) (* (+ 1.0 (sqrt (exp (* a x)))) (+ (sqrt (exp (* a x))) -1.0)) (* a (+ x (* (* x (* a x)) 0.5)))))
double code(double a, double x) {
return exp(a * x) - 1.0;
}
double code(double a, double x) {
double tmp;
if ((a * x) <= -0.05266943121646845) {
tmp = (1.0 + sqrt(exp(a * x))) * (sqrt(exp(a * x)) + -1.0);
} else {
tmp = a * (x + ((x * (a * x)) * 0.5));
}
return tmp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.6 |
|---|---|
| Target | 0.2 |
| Herbie | 0.5 |
if (*.f64 a x) < -0.05266943121646845Initial program 0.0
rmApplied add-sqr-sqrt_binary64_14640.0
Applied difference-of-sqr-1_binary64_14120.0
Simplified0.0
Simplified0.0
if -0.05266943121646845 < (*.f64 a x) Initial program 44.5
rmApplied flip3--_binary64_144644.6
Simplified44.6
Simplified44.6
Taylor expanded around 0 8.6
Simplified0.9
Taylor expanded around 0 8.5
Simplified0.7
Final simplification0.5
herbie shell --seed 2021032
(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))