\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -316431240279237349867520:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\
\mathbf{elif}\;y \le 1.595212172464986205719205231531851770116 \cdot 10^{-42}:\\
\;\;\;\;\frac{x}{x - y} \cdot \left(2 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\
\end{array}double f(double x, double y) {
double r17682410 = x;
double r17682411 = 2.0;
double r17682412 = r17682410 * r17682411;
double r17682413 = y;
double r17682414 = r17682412 * r17682413;
double r17682415 = r17682410 - r17682413;
double r17682416 = r17682414 / r17682415;
return r17682416;
}
double f(double x, double y) {
double r17682417 = y;
double r17682418 = -3.1643124027923735e+23;
bool r17682419 = r17682417 <= r17682418;
double r17682420 = x;
double r17682421 = 2.0;
double r17682422 = r17682420 * r17682421;
double r17682423 = r17682420 - r17682417;
double r17682424 = r17682423 / r17682417;
double r17682425 = r17682422 / r17682424;
double r17682426 = 1.5952121724649862e-42;
bool r17682427 = r17682417 <= r17682426;
double r17682428 = r17682420 / r17682423;
double r17682429 = r17682421 * r17682417;
double r17682430 = r17682428 * r17682429;
double r17682431 = r17682427 ? r17682430 : r17682425;
double r17682432 = r17682419 ? r17682425 : r17682431;
return r17682432;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.0 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
if y < -3.1643124027923735e+23 or 1.5952121724649862e-42 < y Initial program 15.6
rmApplied associate-/l*0.2
if -3.1643124027923735e+23 < y < 1.5952121724649862e-42Initial program 14.4
rmApplied associate-/l*16.2
rmApplied div-inv16.3
Applied times-frac0.2
Simplified0.1
Final simplification0.1
herbie shell --seed 2019170 +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)))