\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -29856493142547368 \lor \neg \left(y \le 2.1640309147455017 \cdot 10^{-67}\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 r512996 = x;
double r512997 = 2.0;
double r512998 = r512996 * r512997;
double r512999 = y;
double r513000 = r512998 * r512999;
double r513001 = r512996 - r512999;
double r513002 = r513000 / r513001;
return r513002;
}
double f(double x, double y) {
double r513003 = y;
double r513004 = -2.985649314254737e+16;
bool r513005 = r513003 <= r513004;
double r513006 = 2.1640309147455017e-67;
bool r513007 = r513003 <= r513006;
double r513008 = !r513007;
bool r513009 = r513005 || r513008;
double r513010 = x;
double r513011 = 2.0;
double r513012 = r513010 * r513011;
double r513013 = r513010 - r513003;
double r513014 = r513013 / r513003;
double r513015 = r513012 / r513014;
double r513016 = r513012 / r513013;
double r513017 = r513016 * r513003;
double r513018 = r513009 ? r513015 : r513017;
return r513018;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.3 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
if y < -2.985649314254737e+16 or 2.1640309147455017e-67 < y Initial program 15.3
rmApplied associate-/l*0.4
if -2.985649314254737e+16 < y < 2.1640309147455017e-67Initial program 15.3
rmApplied associate-/l*16.1
rmApplied associate-/r/0.1
Final simplification0.2
herbie shell --seed 2020047 +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)))