e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -3.823250776763988242543113038607316411799 \cdot 10^{-4}:\\
\;\;\;\;\left(\sqrt[3]{e^{a \cdot x} - 1} \cdot \sqrt[3]{\log \left(e^{e^{a \cdot x} - 1}\right)}\right) \cdot \log \left(e^{\sqrt[3]{\log \left(e^{e^{a \cdot x} - 1}\right)}}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{2}, {a}^{2} \cdot {x}^{2}, \mathsf{fma}\left(\frac{1}{6}, {a}^{3} \cdot {x}^{3}, a \cdot x\right)\right)\\
\end{array}double f(double a, double x) {
double r101395 = a;
double r101396 = x;
double r101397 = r101395 * r101396;
double r101398 = exp(r101397);
double r101399 = 1.0;
double r101400 = r101398 - r101399;
return r101400;
}
double f(double a, double x) {
double r101401 = a;
double r101402 = x;
double r101403 = r101401 * r101402;
double r101404 = -0.0003823250776763988;
bool r101405 = r101403 <= r101404;
double r101406 = exp(r101403);
double r101407 = 1.0;
double r101408 = r101406 - r101407;
double r101409 = cbrt(r101408);
double r101410 = exp(r101408);
double r101411 = log(r101410);
double r101412 = cbrt(r101411);
double r101413 = r101409 * r101412;
double r101414 = exp(r101412);
double r101415 = log(r101414);
double r101416 = r101413 * r101415;
double r101417 = 0.5;
double r101418 = 2.0;
double r101419 = pow(r101401, r101418);
double r101420 = pow(r101402, r101418);
double r101421 = r101419 * r101420;
double r101422 = 0.16666666666666666;
double r101423 = 3.0;
double r101424 = pow(r101401, r101423);
double r101425 = pow(r101402, r101423);
double r101426 = r101424 * r101425;
double r101427 = fma(r101422, r101426, r101403);
double r101428 = fma(r101417, r101421, r101427);
double r101429 = r101405 ? r101416 : r101428;
return r101429;
}




Bits error versus a




Bits error versus x
| Original | 29.6 |
|---|---|
| Target | 0.2 |
| Herbie | 9.9 |
if (* a x) < -0.0003823250776763988Initial program 0.0
rmApplied add-cube-cbrt0.1
rmApplied add-log-exp0.1
rmApplied add-log-exp0.1
Applied add-log-exp0.1
Applied diff-log0.1
Simplified0.1
rmApplied add-log-exp0.1
Applied add-log-exp0.1
Applied diff-log0.1
Simplified0.1
if -0.0003823250776763988 < (* a x) Initial program 44.1
Taylor expanded around 0 14.7
Simplified14.7
Final simplification9.9
herbie shell --seed 2019362 +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))