\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;x \le -3.75321797851906779486008847671727426178 \cdot 10^{-87} \lor \neg \left(x \le 1.400872302202354975456358848427742881356 \cdot 10^{-45}\right):\\
\;\;\;\;\frac{2 \cdot x}{x - y} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot x}{\frac{x}{y} - 1}\\
\end{array}double f(double x, double y) {
double r514341 = x;
double r514342 = 2.0;
double r514343 = r514341 * r514342;
double r514344 = y;
double r514345 = r514343 * r514344;
double r514346 = r514341 - r514344;
double r514347 = r514345 / r514346;
return r514347;
}
double f(double x, double y) {
double r514348 = x;
double r514349 = -3.753217978519068e-87;
bool r514350 = r514348 <= r514349;
double r514351 = 1.400872302202355e-45;
bool r514352 = r514348 <= r514351;
double r514353 = !r514352;
bool r514354 = r514350 || r514353;
double r514355 = 2.0;
double r514356 = r514355 * r514348;
double r514357 = y;
double r514358 = r514348 - r514357;
double r514359 = r514356 / r514358;
double r514360 = r514359 * r514357;
double r514361 = r514348 / r514357;
double r514362 = 1.0;
double r514363 = r514361 - r514362;
double r514364 = r514356 / r514363;
double r514365 = r514354 ? r514360 : r514364;
return r514365;
}




Bits error versus x




Bits error versus y
Results
| Original | 14.9 |
|---|---|
| Target | 0.4 |
| Herbie | 0.3 |
if x < -3.753217978519068e-87 or 1.400872302202355e-45 < x Initial program 13.7
Simplified12.6
rmApplied div-inv12.7
Simplified12.1
rmApplied associate-*r*0.7
Simplified0.5
if -3.753217978519068e-87 < x < 1.400872302202355e-45Initial program 16.6
Simplified0.0
rmApplied div-sub0.0
Simplified0.0
Final simplification0.3
herbie shell --seed 2019179
(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)))