\frac{x0}{1 - x1} - x0\begin{array}{l}
\mathbf{if}\;x0 \le 1.87492187499999985:\\
\;\;\;\;\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 r155484 = x0;
double r155485 = 1.0;
double r155486 = x1;
double r155487 = r155485 - r155486;
double r155488 = r155484 / r155487;
double r155489 = r155488 - r155484;
return r155489;
}
double f(double x0, double x1) {
double r155490 = x0;
double r155491 = 1.8749218749999998;
bool r155492 = r155490 <= r155491;
double r155493 = sqrt(r155490);
double r155494 = 1.0;
double r155495 = sqrt(r155494);
double r155496 = x1;
double r155497 = sqrt(r155496);
double r155498 = r155495 + r155497;
double r155499 = r155493 / r155498;
double r155500 = r155495 - r155497;
double r155501 = r155493 / r155500;
double r155502 = -r155490;
double r155503 = fma(r155499, r155501, r155502);
double r155504 = 1.0;
double r155505 = exp(r155490);
double r155506 = sqrt(r155505);
double r155507 = r155504 / r155506;
double r155508 = log(r155507);
double r155509 = 3.0;
double r155510 = pow(r155508, r155509);
double r155511 = cbrt(r155490);
double r155512 = r155494 - r155496;
double r155513 = r155511 / r155512;
double r155514 = 0.6666666666666666;
double r155515 = pow(r155490, r155514);
double r155516 = fma(r155513, r155515, r155508);
double r155517 = pow(r155516, r155509);
double r155518 = r155510 + r155517;
double r155519 = r155513 * r155515;
double r155520 = r155516 * r155519;
double r155521 = log(r155506);
double r155522 = r155521 * r155521;
double r155523 = r155520 + r155522;
double r155524 = r155518 / r155523;
double r155525 = r155492 ? r155503 : r155524;
return r155525;
}




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.2
rmApplied add-log-exp7.6
Simplified5.9
rmApplied add-sqr-sqrt6.7
Applied *-un-lft-identity6.7
Applied unpow-prod-down6.7
Applied times-frac5.9
Applied log-prod5.8
Simplified5.8
Simplified5.8
rmApplied flip3-+3.6
Simplified3.5
Final simplification4.4
herbie shell --seed 2020059 +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))