\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;x \le -1.678200599830845516946512912055678313986 \cdot 10^{53} \lor \neg \left(x \le 3.181619446512529125094192620739909077175 \cdot 10^{-59}\right):\\
\;\;\;\;\frac{2 \cdot x}{x - y} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot x}{\frac{x - y}{y}}\\
\end{array}double f(double x, double y) {
double r421608 = x;
double r421609 = 2.0;
double r421610 = r421608 * r421609;
double r421611 = y;
double r421612 = r421610 * r421611;
double r421613 = r421608 - r421611;
double r421614 = r421612 / r421613;
return r421614;
}
double f(double x, double y) {
double r421615 = x;
double r421616 = -1.6782005998308455e+53;
bool r421617 = r421615 <= r421616;
double r421618 = 3.181619446512529e-59;
bool r421619 = r421615 <= r421618;
double r421620 = !r421619;
bool r421621 = r421617 || r421620;
double r421622 = 2.0;
double r421623 = r421622 * r421615;
double r421624 = y;
double r421625 = r421615 - r421624;
double r421626 = r421623 / r421625;
double r421627 = r421626 * r421624;
double r421628 = r421625 / r421624;
double r421629 = r421623 / r421628;
double r421630 = r421621 ? r421627 : r421629;
return r421630;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.3 |
|---|---|
| Target | 0.4 |
| Herbie | 0.3 |
if x < -1.6782005998308455e+53 or 3.181619446512529e-59 < x Initial program 16.0
Simplified15.0
rmApplied associate-/r/0.4
if -1.6782005998308455e+53 < x < 3.181619446512529e-59Initial program 14.5
Simplified0.3
Final simplification0.3
herbie shell --seed 2019196 +o rules:numerics
(FPCore (x y)
:name "Linear.Projection:perspective from linear-1.19.1.3, B"
:herbie-target
(if (< x -1.7210442634149447e+81) (* (/ (* 2.0 x) (- x y)) y) (if (< x 8.364504563556443e+16) (/ (* x 2.0) (/ (- x y) y)) (* (/ (* 2.0 x) (- x y)) y)))
(/ (* (* x 2.0) y) (- x y)))