\frac{\left(x \cdot 2.0\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;x \le -1.5429547294769742 \cdot 10^{+40}:\\
\;\;\;\;\frac{2.0 \cdot x}{x - y} \cdot y\\
\mathbf{elif}\;x \le 8733142429638575.0:\\
\;\;\;\;\frac{2.0 \cdot x}{\frac{x}{y} - 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{2.0 \cdot x}{x - y} \cdot y\\
\end{array}double f(double x, double y) {
double r13704886 = x;
double r13704887 = 2.0;
double r13704888 = r13704886 * r13704887;
double r13704889 = y;
double r13704890 = r13704888 * r13704889;
double r13704891 = r13704886 - r13704889;
double r13704892 = r13704890 / r13704891;
return r13704892;
}
double f(double x, double y) {
double r13704893 = x;
double r13704894 = -1.5429547294769742e+40;
bool r13704895 = r13704893 <= r13704894;
double r13704896 = 2.0;
double r13704897 = r13704896 * r13704893;
double r13704898 = y;
double r13704899 = r13704893 - r13704898;
double r13704900 = r13704897 / r13704899;
double r13704901 = r13704900 * r13704898;
double r13704902 = 8733142429638575.0;
bool r13704903 = r13704893 <= r13704902;
double r13704904 = r13704893 / r13704898;
double r13704905 = 1.0;
double r13704906 = r13704904 - r13704905;
double r13704907 = r13704897 / r13704906;
double r13704908 = r13704903 ? r13704907 : r13704901;
double r13704909 = r13704895 ? r13704901 : r13704908;
return r13704909;
}




Bits error versus x




Bits error versus y
Results
| Original | 14.5 |
|---|---|
| Target | 0.4 |
| Herbie | 0.1 |
if x < -1.5429547294769742e+40 or 8733142429638575.0 < x Initial program 16.6
rmApplied associate-/l*16.8
rmApplied associate-/r/0.1
if -1.5429547294769742e+40 < x < 8733142429638575.0Initial program 12.7
rmApplied associate-/l*0.2
rmApplied div-sub0.2
Simplified0.2
Final simplification0.1
herbie shell --seed 2019158 +o rules:numerics
(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)))