\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 r107419 = x0;
double r107420 = 1.0;
double r107421 = x1;
double r107422 = r107420 - r107421;
double r107423 = r107419 / r107422;
double r107424 = r107423 - r107419;
return r107424;
}
double f(double x0, double x1) {
double r107425 = x0;
double r107426 = 1.8749218749999998;
bool r107427 = r107425 <= r107426;
double r107428 = sqrt(r107425);
double r107429 = 1.0;
double r107430 = sqrt(r107429);
double r107431 = x1;
double r107432 = sqrt(r107431);
double r107433 = r107430 + r107432;
double r107434 = r107428 / r107433;
double r107435 = r107430 - r107432;
double r107436 = r107428 / r107435;
double r107437 = -r107425;
double r107438 = fma(r107434, r107436, r107437);
double r107439 = 1.0;
double r107440 = exp(r107425);
double r107441 = sqrt(r107440);
double r107442 = r107439 / r107441;
double r107443 = log(r107442);
double r107444 = 3.0;
double r107445 = pow(r107443, r107444);
double r107446 = cbrt(r107425);
double r107447 = r107429 - r107431;
double r107448 = r107446 / r107447;
double r107449 = 0.6666666666666666;
double r107450 = pow(r107425, r107449);
double r107451 = fma(r107448, r107450, r107443);
double r107452 = pow(r107451, r107444);
double r107453 = r107445 + r107452;
double r107454 = r107448 * r107450;
double r107455 = r107451 * r107454;
double r107456 = log(r107441);
double r107457 = r107456 * r107456;
double r107458 = r107455 + r107457;
double r107459 = r107453 / r107458;
double r107460 = r107427 ? r107438 : r107459;
return r107460;
}




Bits error versus x0




Bits error versus x1
| Original | 7.8 |
|---|---|
| Target | 0.3 |
| 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.2
if 1.8749218749999998 < x0 Initial program 8.3
rmApplied *-un-lft-identity8.3
Applied add-cube-cbrt8.3
Applied times-frac8.3
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.7
Simplified5.7
Simplified5.7
rmApplied flip3-+3.6
Simplified3.5
Final simplification4.4
herbie shell --seed 2020018 +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))