\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;x \le -3.0306756776612656 \cdot 10^{44} \lor \neg \left(x \le 8.69159111879264488 \cdot 10^{-21}\right):\\
\;\;\;\;\frac{x \cdot 2}{x - y} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{1 \cdot \left(\frac{x}{y} - 1\right)}\\
\end{array}double f(double x, double y) {
double r491515 = x;
double r491516 = 2.0;
double r491517 = r491515 * r491516;
double r491518 = y;
double r491519 = r491517 * r491518;
double r491520 = r491515 - r491518;
double r491521 = r491519 / r491520;
return r491521;
}
double f(double x, double y) {
double r491522 = x;
double r491523 = -3.0306756776612656e+44;
bool r491524 = r491522 <= r491523;
double r491525 = 8.691591118792645e-21;
bool r491526 = r491522 <= r491525;
double r491527 = !r491526;
bool r491528 = r491524 || r491527;
double r491529 = 2.0;
double r491530 = r491522 * r491529;
double r491531 = y;
double r491532 = r491522 - r491531;
double r491533 = r491530 / r491532;
double r491534 = r491533 * r491531;
double r491535 = 1.0;
double r491536 = r491522 / r491531;
double r491537 = r491536 - r491535;
double r491538 = r491535 * r491537;
double r491539 = r491530 / r491538;
double r491540 = r491528 ? r491534 : r491539;
return r491540;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.1 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
if x < -3.0306756776612656e+44 or 8.691591118792645e-21 < x Initial program 16.6
rmApplied associate-/l*15.4
rmApplied associate-/r/0.2
if -3.0306756776612656e+44 < x < 8.691591118792645e-21Initial program 13.7
rmApplied associate-/l*0.2
rmApplied *-un-lft-identity0.2
Applied *-un-lft-identity0.2
Applied times-frac0.2
Simplified0.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2020081 +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)))