e^{a \cdot x} - 1\begin{array}{l}
\mathbf{if}\;a \cdot x \le -48.69806950283927449163456913083791732788:\\
\;\;\;\;\sqrt[3]{e^{a \cdot x} - 1} \cdot \left(\sqrt[3]{e^{a \cdot x} - 1} \cdot \log \left(e^{\sqrt[3]{e^{a \cdot x} - 1}}\right)\right)\\
\mathbf{elif}\;a \cdot x \le 1.399335336201219789742515322647377985716 \cdot 10^{-29}:\\
\;\;\;\;\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)\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{e^{a \cdot x} - 1} \cdot \left(\sqrt[3]{\sqrt{e^{a \cdot x} - 1} \cdot \sqrt{e^{a \cdot x} - 1}} \cdot \left(\sqrt[3]{\sqrt{e^{a \cdot x}} + \sqrt{1}} \cdot \sqrt[3]{\sqrt{e^{a \cdot x}} - \sqrt{1}}\right)\right)\\
\end{array}double f(double a, double x) {
double r113294 = a;
double r113295 = x;
double r113296 = r113294 * r113295;
double r113297 = exp(r113296);
double r113298 = 1.0;
double r113299 = r113297 - r113298;
return r113299;
}
double f(double a, double x) {
double r113300 = a;
double r113301 = x;
double r113302 = r113300 * r113301;
double r113303 = -48.698069502839274;
bool r113304 = r113302 <= r113303;
double r113305 = exp(r113302);
double r113306 = 1.0;
double r113307 = r113305 - r113306;
double r113308 = cbrt(r113307);
double r113309 = exp(r113308);
double r113310 = log(r113309);
double r113311 = r113308 * r113310;
double r113312 = r113308 * r113311;
double r113313 = 1.3993353362012198e-29;
bool r113314 = r113302 <= r113313;
double r113315 = 0.5;
double r113316 = 2.0;
double r113317 = pow(r113300, r113316);
double r113318 = pow(r113301, r113316);
double r113319 = r113317 * r113318;
double r113320 = 0.16666666666666666;
double r113321 = 3.0;
double r113322 = pow(r113300, r113321);
double r113323 = pow(r113301, r113321);
double r113324 = r113322 * r113323;
double r113325 = fma(r113320, r113324, r113302);
double r113326 = fma(r113315, r113319, r113325);
double r113327 = sqrt(r113307);
double r113328 = r113327 * r113327;
double r113329 = cbrt(r113328);
double r113330 = sqrt(r113305);
double r113331 = sqrt(r113306);
double r113332 = r113330 + r113331;
double r113333 = cbrt(r113332);
double r113334 = r113330 - r113331;
double r113335 = cbrt(r113334);
double r113336 = r113333 * r113335;
double r113337 = r113329 * r113336;
double r113338 = r113308 * r113337;
double r113339 = r113314 ? r113326 : r113338;
double r113340 = r113304 ? r113312 : r113339;
return r113340;
}




Bits error versus a




Bits error versus x
| Original | 29.6 |
|---|---|
| Target | 0.2 |
| Herbie | 9.6 |
if (* a x) < -48.698069502839274Initial program 0
rmApplied add-log-exp0
Applied add-log-exp0
Applied diff-log0
Simplified0
rmApplied add-cube-cbrt0
Applied exp-prod0
Applied log-pow0
Simplified0
rmApplied add-log-exp0
if -48.698069502839274 < (* a x) < 1.3993353362012198e-29Initial program 44.6
Taylor expanded around 0 13.1
Simplified13.1
if 1.3993353362012198e-29 < (* a x) Initial program 36.2
rmApplied add-log-exp36.2
Applied add-log-exp38.4
Applied diff-log38.7
Simplified38.4
rmApplied add-cube-cbrt38.4
Applied exp-prod38.5
Applied log-pow38.4
Simplified36.2
rmApplied add-sqr-sqrt36.2
Applied add-sqr-sqrt36.7
Applied difference-of-squares36.7
Applied cbrt-prod36.7
rmApplied add-sqr-sqrt36.7
Final simplification9.6
herbie shell --seed 2019346 +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))