e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -0.26310033146711964:\\
\;\;\;\;\log \left(e^{e^{a \cdot x} - 1}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{2}, {\left(x \cdot a\right)}^{2}, \mathsf{fma}\left(\frac{1}{6}, {\left(x \cdot a\right)}^{3}, a \cdot x\right)\right)\\
\end{array}double code(double a, double x) {
return ((double) (((double) exp(((double) (a * x)))) - 1.0));
}
double code(double a, double x) {
double VAR;
if ((((double) (a * x)) <= -0.26310033146711964)) {
VAR = ((double) log(((double) exp(((double) (((double) exp(((double) (a * x)))) - 1.0))))));
} else {
VAR = ((double) fma(0.5, ((double) pow(((double) (x * a)), 2.0)), ((double) fma(0.16666666666666666, ((double) pow(((double) (x * a)), 3.0)), ((double) (a * x))))));
}
return VAR;
}




Bits error versus a




Bits error versus x
Results
| Original | 29.1 |
|---|---|
| Target | 0.2 |
| Herbie | 0.4 |
if (* a x) < -0.26310033146711964Initial program 0.0
rmApplied add-log-exp0.0
Applied add-log-exp0.0
Applied diff-log0.0
Simplified0.0
if -0.26310033146711964 < (* a x) Initial program 43.6
Taylor expanded around 0 14.5
Simplified14.5
rmApplied pow-prod-down8.4
Simplified8.4
rmApplied pow-prod-down0.7
Simplified0.7
Final simplification0.4
herbie shell --seed 2020121 +o rules:numerics
(FPCore (a x)
:name "expax (section 3.5)"
:precision binary64
:herbie-expected 14
:herbie-target
(if (< (fabs (* a x)) 0.1) (* (* a x) (+ 1 (+ (/ (* a x) 2) (/ (pow (* a x) 2) 6)))) (- (exp (* a x)) 1))
(- (exp (* a x)) 1))