\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -1.1116518480520122 \cdot 10^{66} \lor \neg \left(y \le 3.6268085031482395 \cdot 10^{-63}\right):\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{x - y} \cdot y\\
\end{array}double f(double x, double y) {
double r530602 = x;
double r530603 = 2.0;
double r530604 = r530602 * r530603;
double r530605 = y;
double r530606 = r530604 * r530605;
double r530607 = r530602 - r530605;
double r530608 = r530606 / r530607;
return r530608;
}
double f(double x, double y) {
double r530609 = y;
double r530610 = -1.1116518480520122e+66;
bool r530611 = r530609 <= r530610;
double r530612 = 3.6268085031482395e-63;
bool r530613 = r530609 <= r530612;
double r530614 = !r530613;
bool r530615 = r530611 || r530614;
double r530616 = x;
double r530617 = 2.0;
double r530618 = r530616 * r530617;
double r530619 = r530616 - r530609;
double r530620 = r530619 / r530609;
double r530621 = r530618 / r530620;
double r530622 = r530618 / r530619;
double r530623 = r530622 * r530609;
double r530624 = r530615 ? r530621 : r530623;
return r530624;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.5 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if y < -1.1116518480520122e+66 or 3.6268085031482395e-63 < y Initial program 16.5
rmApplied associate-/l*0.5
if -1.1116518480520122e+66 < y < 3.6268085031482395e-63Initial program 14.4
rmApplied associate-/l*14.8
rmApplied associate-/r/0.4
Final simplification0.4
herbie shell --seed 2020083 +o rules:numerics
(FPCore (x y)
:name "Linear.Projection:perspective from linear-1.19.1.3, B"
:precision binary64
:herbie-target
(if (< x -1.7210442634149447e+81) (* (/ (* 2 x) (- x y)) y) (if (< x 83645045635564432) (/ (* x 2) (/ (- x y) y)) (* (/ (* 2 x) (- x y)) y)))
(/ (* (* x 2) y) (- x y)))