\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -1.93403941868859091 \cdot 10^{-36} \lor \neg \left(y \le 1.19064852231214522 \cdot 10^{-72}\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 r604598 = x;
double r604599 = 2.0;
double r604600 = r604598 * r604599;
double r604601 = y;
double r604602 = r604600 * r604601;
double r604603 = r604598 - r604601;
double r604604 = r604602 / r604603;
return r604604;
}
double f(double x, double y) {
double r604605 = y;
double r604606 = -1.934039418688591e-36;
bool r604607 = r604605 <= r604606;
double r604608 = 1.1906485223121452e-72;
bool r604609 = r604605 <= r604608;
double r604610 = !r604609;
bool r604611 = r604607 || r604610;
double r604612 = x;
double r604613 = 2.0;
double r604614 = r604612 * r604613;
double r604615 = r604612 - r604605;
double r604616 = r604615 / r604605;
double r604617 = r604614 / r604616;
double r604618 = r604614 / r604615;
double r604619 = r604618 * r604605;
double r604620 = r604611 ? r604617 : r604619;
return r604620;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.3 |
|---|---|
| Target | 0.3 |
| Herbie | 0.3 |
if y < -1.934039418688591e-36 or 1.1906485223121452e-72 < y Initial program 14.4
rmApplied associate-/l*0.4
if -1.934039418688591e-36 < y < 1.1906485223121452e-72Initial program 16.6
rmApplied associate-/l*17.8
rmApplied associate-/r/0.1
Final simplification0.3
herbie shell --seed 2020060 +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)))