e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \leq -0.005563956516231315:\\
\;\;\;\;\log \left(\sqrt{e^{e^{a \cdot x} - 1}}\right) + \log \left(\sqrt{e^{e^{a \cdot x} - 1}}\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot x + {\left(a \cdot x\right)}^{2} \cdot \left(0.5 + \left(a \cdot x\right) \cdot 0.16666666666666666\right)\\
\end{array}(FPCore (a x) :precision binary64 (- (exp (* a x)) 1.0))
(FPCore (a x)
:precision binary64
(if (<= (* a x) -0.005563956516231315)
(+
(log (sqrt (exp (- (exp (* a x)) 1.0))))
(log (sqrt (exp (- (exp (* a x)) 1.0)))))
(+ (* a x) (* (pow (* a x) 2.0) (+ 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) <= -0.005563956516231315) {
tmp = log(sqrt(exp(exp(a * x) - 1.0))) + log(sqrt(exp(exp(a * x) - 1.0)));
} else {
tmp = (a * x) + (pow((a * x), 2.0) * (0.5 + ((a * x) * 0.16666666666666666)));
}
return tmp;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.5 |
|---|---|
| Target | 0.1 |
| Herbie | 0.3 |
if (*.f64 a x) < -0.0055639565162313148Initial program 0.0
rmApplied add-log-exp_binary64_11400.0
Applied add-log-exp_binary64_11400.0
Applied diff-log_binary64_11930.0
Simplified0.0
rmApplied add-sqr-sqrt_binary64_11230.0
Applied log-prod_binary64_11870.0
if -0.0055639565162313148 < (*.f64 a x) Initial program 44.5
Taylor expanded around 0 14.4
Simplified0.5
Taylor expanded around 0 14.4
Simplified0.5
Final simplification0.3
herbie shell --seed 2021075
(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))