\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 r171441 = x0;
double r171442 = 1.0;
double r171443 = x1;
double r171444 = r171442 - r171443;
double r171445 = r171441 / r171444;
double r171446 = r171445 - r171441;
return r171446;
}
double f(double x0, double x1) {
double r171447 = x0;
double r171448 = 1.8749218749999998;
bool r171449 = r171447 <= r171448;
double r171450 = sqrt(r171447);
double r171451 = 1.0;
double r171452 = sqrt(r171451);
double r171453 = x1;
double r171454 = sqrt(r171453);
double r171455 = r171452 + r171454;
double r171456 = r171450 / r171455;
double r171457 = r171452 - r171454;
double r171458 = r171450 / r171457;
double r171459 = -r171447;
double r171460 = fma(r171456, r171458, r171459);
double r171461 = 1.0;
double r171462 = exp(r171447);
double r171463 = sqrt(r171462);
double r171464 = r171461 / r171463;
double r171465 = log(r171464);
double r171466 = 3.0;
double r171467 = pow(r171465, r171466);
double r171468 = cbrt(r171447);
double r171469 = r171451 - r171453;
double r171470 = r171468 / r171469;
double r171471 = 0.6666666666666666;
double r171472 = pow(r171447, r171471);
double r171473 = fma(r171470, r171472, r171465);
double r171474 = pow(r171473, r171466);
double r171475 = r171467 + r171474;
double r171476 = r171470 * r171472;
double r171477 = r171473 * r171476;
double r171478 = log(r171463);
double r171479 = r171478 * r171478;
double r171480 = r171477 + r171479;
double r171481 = r171475 / r171480;
double r171482 = r171449 ? r171460 : r171481;
return r171482;
}




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.4
if 1.8749218749999998 < x0 Initial program 8.2
rmApplied *-un-lft-identity8.2
Applied add-cube-cbrt8.2
Applied times-frac8.2
Applied fma-neg7.0
rmApplied add-log-exp7.5
Simplified5.7
rmApplied add-sqr-sqrt6.4
Applied *-un-lft-identity6.4
Applied unpow-prod-down6.4
Applied times-frac5.7
Applied log-prod5.7
Simplified5.7
Simplified5.7
rmApplied flip3-+3.5
Simplified3.5
Final simplification4.4
herbie shell --seed 2020001 +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))