\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -11894198345334408230327762615508217626620:\\
\;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\
\mathbf{elif}\;y \le 3.827108002628365811088571233801504531292 \cdot 10^{68}:\\
\;\;\;\;\frac{x \cdot 2}{x - y} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\
\end{array}double f(double x, double y) {
double r479387 = x;
double r479388 = 2.0;
double r479389 = r479387 * r479388;
double r479390 = y;
double r479391 = r479389 * r479390;
double r479392 = r479387 - r479390;
double r479393 = r479391 / r479392;
return r479393;
}
double f(double x, double y) {
double r479394 = y;
double r479395 = -1.1894198345334408e+40;
bool r479396 = r479394 <= r479395;
double r479397 = x;
double r479398 = 2.0;
double r479399 = r479397 * r479398;
double r479400 = r479397 - r479394;
double r479401 = r479394 / r479400;
double r479402 = r479399 * r479401;
double r479403 = 3.827108002628366e+68;
bool r479404 = r479394 <= r479403;
double r479405 = r479399 / r479400;
double r479406 = r479405 * r479394;
double r479407 = r479400 / r479394;
double r479408 = r479399 / r479407;
double r479409 = r479404 ? r479406 : r479408;
double r479410 = r479396 ? r479402 : r479409;
return r479410;
}




Bits error versus x




Bits error versus y
Results
| Original | 14.9 |
|---|---|
| Target | 0.4 |
| Herbie | 0.2 |
if y < -1.1894198345334408e+40Initial program 18.3
rmApplied *-un-lft-identity18.3
Applied times-frac0.2
Simplified0.2
if -1.1894198345334408e+40 < y < 3.827108002628366e+68Initial program 11.9
rmApplied associate-/l*12.7
rmApplied associate-/r/0.3
if 3.827108002628366e+68 < y Initial program 20.2
rmApplied associate-/l*0.1
Final simplification0.2
herbie shell --seed 2020001 +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)))