\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} = -\infty \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -1.4108510848905031 \cdot 10^{-307} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -0.0 \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 7.98976594251477736 \cdot 10^{-110}\right)\right)\right):\\
\;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\
\end{array}double f(double x, double y) {
double r524710 = x;
double r524711 = 2.0;
double r524712 = r524710 * r524711;
double r524713 = y;
double r524714 = r524712 * r524713;
double r524715 = r524710 - r524713;
double r524716 = r524714 / r524715;
return r524716;
}
double f(double x, double y) {
double r524717 = x;
double r524718 = 2.0;
double r524719 = r524717 * r524718;
double r524720 = y;
double r524721 = r524719 * r524720;
double r524722 = r524717 - r524720;
double r524723 = r524721 / r524722;
double r524724 = -inf.0;
bool r524725 = r524723 <= r524724;
double r524726 = -1.410851084890503e-307;
bool r524727 = r524723 <= r524726;
double r524728 = -0.0;
bool r524729 = r524723 <= r524728;
double r524730 = 7.989765942514777e-110;
bool r524731 = r524723 <= r524730;
double r524732 = !r524731;
bool r524733 = r524729 || r524732;
double r524734 = !r524733;
bool r524735 = r524727 || r524734;
double r524736 = !r524735;
bool r524737 = r524725 || r524736;
double r524738 = r524720 / r524722;
double r524739 = r524719 * r524738;
double r524740 = r524737 ? r524739 : r524723;
return r524740;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.1 |
|---|---|
| Target | 0.4 |
| Herbie | 0.9 |
if (/ (* (* x 2.0) y) (- x y)) < -inf.0 or -1.410851084890503e-307 < (/ (* (* x 2.0) y) (- x y)) < -0.0 or 7.989765942514777e-110 < (/ (* (* x 2.0) y) (- x y)) Initial program 35.8
rmApplied *-un-lft-identity35.8
Applied times-frac1.2
Simplified1.2
if -inf.0 < (/ (* (* x 2.0) y) (- x y)) < -1.410851084890503e-307 or -0.0 < (/ (* (* x 2.0) y) (- x y)) < 7.989765942514777e-110Initial program 0.7
Final simplification0.9
herbie shell --seed 2020024 +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)))