\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;x \le -7.904038736975755 \cdot 10^{40} \lor \neg \left(x \le 2.2748860877863723 \cdot 10^{-47}\right):\\
\;\;\;\;\frac{x \cdot 2}{x - y} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\
\end{array}double f(double x, double y) {
double r399100 = x;
double r399101 = 2.0;
double r399102 = r399100 * r399101;
double r399103 = y;
double r399104 = r399102 * r399103;
double r399105 = r399100 - r399103;
double r399106 = r399104 / r399105;
return r399106;
}
double f(double x, double y) {
double r399107 = x;
double r399108 = -7.904038736975755e+40;
bool r399109 = r399107 <= r399108;
double r399110 = 2.2748860877863723e-47;
bool r399111 = r399107 <= r399110;
double r399112 = !r399111;
bool r399113 = r399109 || r399112;
double r399114 = 2.0;
double r399115 = r399107 * r399114;
double r399116 = y;
double r399117 = r399107 - r399116;
double r399118 = r399115 / r399117;
double r399119 = r399118 * r399116;
double r399120 = r399116 / r399117;
double r399121 = r399115 * r399120;
double r399122 = r399113 ? r399119 : r399121;
return r399122;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.3 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
if x < -7.904038736975755e+40 or 2.2748860877863723e-47 < x Initial program 16.6
rmApplied associate-/l*14.9
rmApplied associate-/r/0.3
if -7.904038736975755e+40 < x < 2.2748860877863723e-47Initial program 13.9
rmApplied *-un-lft-identity13.9
Applied times-frac0.2
Simplified0.2
Final simplification0.2
herbie shell --seed 2019199 +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)))