\frac{x0}{1 - x1} - x0\begin{array}{l}
\mathbf{if}\;x1 \le 0.01820459765624999823319107861152588156983:\\
\;\;\;\;\mathsf{fma}\left(\sqrt[3]{x0} \cdot \sqrt[3]{x0}, \frac{\sqrt[3]{x0}}{1 - x1}, -x0\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\sqrt{x0}}{\sqrt{1} + \sqrt{x1}}, \frac{\sqrt{x0}}{\sqrt{1} - \sqrt{x1}}, -x0\right) + \mathsf{fma}\left(x0, -1, x0\right)\\
\end{array}double f(double x0, double x1) {
double r182011 = x0;
double r182012 = 1.0;
double r182013 = x1;
double r182014 = r182012 - r182013;
double r182015 = r182011 / r182014;
double r182016 = r182015 - r182011;
return r182016;
}
double f(double x0, double x1) {
double r182017 = x1;
double r182018 = 0.018204597656249998;
bool r182019 = r182017 <= r182018;
double r182020 = x0;
double r182021 = cbrt(r182020);
double r182022 = r182021 * r182021;
double r182023 = 1.0;
double r182024 = r182023 - r182017;
double r182025 = r182021 / r182024;
double r182026 = -r182020;
double r182027 = fma(r182022, r182025, r182026);
double r182028 = sqrt(r182020);
double r182029 = sqrt(r182023);
double r182030 = sqrt(r182017);
double r182031 = r182029 + r182030;
double r182032 = r182028 / r182031;
double r182033 = r182029 - r182030;
double r182034 = r182028 / r182033;
double r182035 = fma(r182032, r182034, r182026);
double r182036 = -1.0;
double r182037 = fma(r182020, r182036, r182020);
double r182038 = r182035 + r182037;
double r182039 = r182019 ? r182027 : r182038;
return r182039;
}




Bits error versus x0




Bits error versus x1
| Original | 7.8 |
|---|---|
| Target | 0.2 |
| Herbie | 6.0 |
if x1 < 0.018204597656249998Initial program 11.2
rmApplied *-un-lft-identity11.2
Applied add-cube-cbrt11.2
Applied times-frac10.9
Applied fma-neg8.9
if 0.018204597656249998 < x1 Initial program 4.5
rmApplied add-sqr-sqrt4.5
Applied add-sqr-sqrt4.5
Applied add-sqr-sqrt4.5
Applied difference-of-squares4.5
Applied add-sqr-sqrt4.5
Applied times-frac5.2
Applied prod-diff4.8
Simplified4.8
Simplified3.2
Final simplification6.0
herbie shell --seed 2019179 +o rules:numerics
(FPCore (x0 x1)
:name "(- (/ x0 (- 1 x1)) x0)"
:pre (or (and (== x0 1.855) (== x1 0.000209)) (and (== x0 2.985) (== x1 0.0186)))
:herbie-target
(/ (* x0 x1) (- 1.0 x1))
(- (/ x0 (- 1.0 x1)) x0))