\frac{x0}{1 - x1} - x0\begin{array}{l}
\mathbf{if}\;x0 \le 1.874921874999999849009668650978710502386:\\
\;\;\;\;\mathsf{fma}\left(\frac{\sqrt{x0}}{\sqrt{1} + \sqrt{x1}}, \frac{\sqrt{x0}}{\sqrt{1} - \sqrt{x1}}, -x0\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{{\left(\log \left(\frac{1}{\sqrt{e^{x0}}}\right)\right)}^{3} + {\left(\mathsf{fma}\left(\frac{\sqrt[3]{x0}}{1 - x1}, {x0}^{\frac{2}{3}}, \log \left(\frac{1}{\sqrt{e^{x0}}}\right)\right)\right)}^{3}}{\mathsf{fma}\left(\frac{\sqrt[3]{x0}}{1 - x1}, {x0}^{\frac{2}{3}}, \log \left(\frac{1}{\sqrt{e^{x0}}}\right)\right) \cdot \left(\frac{\sqrt[3]{x0}}{1 - x1} \cdot {x0}^{\frac{2}{3}}\right) + \log \left(\sqrt{e^{x0}}\right) \cdot \log \left(\sqrt{e^{x0}}\right)}\\
\end{array}double f(double x0, double x1) {
double r201425 = x0;
double r201426 = 1.0;
double r201427 = x1;
double r201428 = r201426 - r201427;
double r201429 = r201425 / r201428;
double r201430 = r201429 - r201425;
return r201430;
}
double f(double x0, double x1) {
double r201431 = x0;
double r201432 = 1.8749218749999998;
bool r201433 = r201431 <= r201432;
double r201434 = sqrt(r201431);
double r201435 = 1.0;
double r201436 = sqrt(r201435);
double r201437 = x1;
double r201438 = sqrt(r201437);
double r201439 = r201436 + r201438;
double r201440 = r201434 / r201439;
double r201441 = r201436 - r201438;
double r201442 = r201434 / r201441;
double r201443 = -r201431;
double r201444 = fma(r201440, r201442, r201443);
double r201445 = 1.0;
double r201446 = exp(r201431);
double r201447 = sqrt(r201446);
double r201448 = r201445 / r201447;
double r201449 = log(r201448);
double r201450 = 3.0;
double r201451 = pow(r201449, r201450);
double r201452 = cbrt(r201431);
double r201453 = r201435 - r201437;
double r201454 = r201452 / r201453;
double r201455 = 0.6666666666666666;
double r201456 = pow(r201431, r201455);
double r201457 = fma(r201454, r201456, r201449);
double r201458 = pow(r201457, r201450);
double r201459 = r201451 + r201458;
double r201460 = r201454 * r201456;
double r201461 = r201457 * r201460;
double r201462 = log(r201447);
double r201463 = r201462 * r201462;
double r201464 = r201461 + r201463;
double r201465 = r201459 / r201464;
double r201466 = r201433 ? r201444 : r201465;
return r201466;
}




Bits error versus x0




Bits error versus x1
| Original | 7.9 |
|---|---|
| Target | 0.2 |
| Herbie | 4.4 |
if x0 < 1.8749218749999998Initial program 7.4
rmApplied add-sqr-sqrt7.4
Applied add-sqr-sqrt7.4
Applied difference-of-squares7.4
Applied add-sqr-sqrt7.4
Applied times-frac7.4
Applied fma-neg5.3
if 1.8749218749999998 < x0 Initial program 8.4
rmApplied *-un-lft-identity8.4
Applied add-cube-cbrt8.4
Applied times-frac8.4
Applied fma-neg7.1
rmApplied add-log-exp7.5
Simplified5.8
rmApplied add-sqr-sqrt6.6
Applied *-un-lft-identity6.6
Applied unpow-prod-down6.6
Applied times-frac5.8
Applied log-prod5.8
Simplified5.8
Simplified5.8
rmApplied flip3-+3.6
Simplified3.5
Final simplification4.4
herbie shell --seed 2019356 +o rules:numerics
(FPCore (x0 x1)
:name "(- (/ x0 (- 1 x1)) x0)"
:precision binary64
:pre (or (and (== x0 1.855) (== x1 0.000209)) (and (== x0 2.985) (== x1 0.0186)))
:herbie-target
(/ (* x0 x1) (- 1 x1))
(- (/ x0 (- 1 x1)) x0))