\frac{x0}{1 - x1} - x0\mathsf{fma}\left(\frac{\sqrt{x0}}{\sqrt{1} + \sqrt{x1}}, \frac{\sqrt{x0}}{\sqrt{1} - \sqrt{x1}}, -x0\right)double f(double x0, double x1) {
double r15360114 = x0;
double r15360115 = 1.0;
double r15360116 = x1;
double r15360117 = r15360115 - r15360116;
double r15360118 = r15360114 / r15360117;
double r15360119 = r15360118 - r15360114;
return r15360119;
}
double f(double x0, double x1) {
double r15360120 = x0;
double r15360121 = sqrt(r15360120);
double r15360122 = 1.0;
double r15360123 = sqrt(r15360122);
double r15360124 = x1;
double r15360125 = sqrt(r15360124);
double r15360126 = r15360123 + r15360125;
double r15360127 = r15360121 / r15360126;
double r15360128 = r15360123 - r15360125;
double r15360129 = r15360121 / r15360128;
double r15360130 = -r15360120;
double r15360131 = fma(r15360127, r15360129, r15360130);
return r15360131;
}




Bits error versus x0




Bits error versus x1
| Original | 8.0 |
|---|---|
| Target | 0.2 |
| Herbie | 7.3 |
Initial program 8.0
rmApplied add-sqr-sqrt8.0
Applied add-sqr-sqrt8.0
Applied difference-of-squares8.0
Applied add-sqr-sqrt8.0
Applied times-frac8.3
Applied fma-neg7.3
Final simplification7.3
herbie shell --seed 2019173 +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))