\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -2.5251409834127483 \cdot 10^{52} \lor \neg \left(y \le 1.226684745187438 \cdot 10^{-25}\right):\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{x - y} \cdot y\\
\end{array}double f(double x, double y) {
double r534774 = x;
double r534775 = 2.0;
double r534776 = r534774 * r534775;
double r534777 = y;
double r534778 = r534776 * r534777;
double r534779 = r534774 - r534777;
double r534780 = r534778 / r534779;
return r534780;
}
double f(double x, double y) {
double r534781 = y;
double r534782 = -2.5251409834127483e+52;
bool r534783 = r534781 <= r534782;
double r534784 = 1.226684745187438e-25;
bool r534785 = r534781 <= r534784;
double r534786 = !r534785;
bool r534787 = r534783 || r534786;
double r534788 = x;
double r534789 = 2.0;
double r534790 = r534788 * r534789;
double r534791 = r534788 - r534781;
double r534792 = r534791 / r534781;
double r534793 = r534790 / r534792;
double r534794 = r534790 / r534791;
double r534795 = r534794 * r534781;
double r534796 = r534787 ? r534793 : r534795;
return r534796;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.5 |
|---|---|
| Target | 0.4 |
| Herbie | 0.2 |
if y < -2.5251409834127483e+52 or 1.226684745187438e-25 < y Initial program 17.4
rmApplied associate-/l*0.1
if -2.5251409834127483e+52 < y < 1.226684745187438e-25Initial program 13.7
rmApplied associate-/l*14.3
rmApplied associate-/r/0.3
Final simplification0.2
herbie shell --seed 2020036
(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)))