\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -4.03649885864486073 \cdot 10^{-67} \lor \neg \left(y \le 9.5601122626142728 \cdot 10^{-5}\right):\\
\;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{x - y} \cdot y\\
\end{array}double f(double x, double y) {
double r512792 = x;
double r512793 = 2.0;
double r512794 = r512792 * r512793;
double r512795 = y;
double r512796 = r512794 * r512795;
double r512797 = r512792 - r512795;
double r512798 = r512796 / r512797;
return r512798;
}
double f(double x, double y) {
double r512799 = y;
double r512800 = -4.036498858644861e-67;
bool r512801 = r512799 <= r512800;
double r512802 = 9.560112262614273e-05;
bool r512803 = r512799 <= r512802;
double r512804 = !r512803;
bool r512805 = r512801 || r512804;
double r512806 = x;
double r512807 = 2.0;
double r512808 = r512806 * r512807;
double r512809 = r512806 - r512799;
double r512810 = r512799 / r512809;
double r512811 = r512808 * r512810;
double r512812 = r512808 / r512809;
double r512813 = r512812 * r512799;
double r512814 = r512805 ? r512811 : r512813;
return r512814;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.1 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
if y < -4.036498858644861e-67 or 9.560112262614273e-05 < y Initial program 15.0
rmApplied *-un-lft-identity15.0
Applied times-frac0.3
Simplified0.3
if -4.036498858644861e-67 < y < 9.560112262614273e-05Initial program 15.3
rmApplied associate-/l*16.3
rmApplied associate-/r/0.1
Final simplification0.2
herbie shell --seed 2020065 +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)))