\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -1.29415460230555196 \cdot 10^{36} \lor \neg \left(y \le 2.4012122731381248 \cdot 10^{-81}\right):\\
\;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x - y} \cdot \left(y \cdot 2\right)\\
\end{array}double f(double x, double y) {
double r595298 = x;
double r595299 = 2.0;
double r595300 = r595298 * r595299;
double r595301 = y;
double r595302 = r595300 * r595301;
double r595303 = r595298 - r595301;
double r595304 = r595302 / r595303;
return r595304;
}
double f(double x, double y) {
double r595305 = y;
double r595306 = -1.294154602305552e+36;
bool r595307 = r595305 <= r595306;
double r595308 = 2.401212273138125e-81;
bool r595309 = r595305 <= r595308;
double r595310 = !r595309;
bool r595311 = r595307 || r595310;
double r595312 = x;
double r595313 = 2.0;
double r595314 = r595312 * r595313;
double r595315 = r595312 - r595305;
double r595316 = r595305 / r595315;
double r595317 = r595314 * r595316;
double r595318 = r595312 / r595315;
double r595319 = r595305 * r595313;
double r595320 = r595318 * r595319;
double r595321 = r595311 ? r595317 : r595320;
return r595321;
}




Bits error versus x




Bits error versus y
Results
| Original | 14.9 |
|---|---|
| Target | 0.3 |
| Herbie | 0.3 |
if y < -1.294154602305552e+36 or 2.401212273138125e-81 < y Initial program 15.3
rmApplied *-un-lft-identity15.3
Applied times-frac0.5
Simplified0.5
if -1.294154602305552e+36 < y < 2.401212273138125e-81Initial program 14.5
rmApplied associate-/l*16.2
rmApplied div-inv16.3
Applied times-frac0.3
Simplified0.1
Final simplification0.3
herbie shell --seed 2020018 +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)))