\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;x \le -5.795611421145836744402935774403637790937 \cdot 10^{-17}:\\
\;\;\;\;\frac{x}{x - y} \cdot \left(2 \cdot y\right)\\
\mathbf{elif}\;x \le 3.247588547814785746124721995699073933232 \cdot 10^{-105}:\\
\;\;\;\;\frac{1}{\frac{\frac{x - y}{y}}{x \cdot 2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x - y} \cdot \left(2 \cdot y\right)\\
\end{array}double f(double x, double y) {
double r37273099 = x;
double r37273100 = 2.0;
double r37273101 = r37273099 * r37273100;
double r37273102 = y;
double r37273103 = r37273101 * r37273102;
double r37273104 = r37273099 - r37273102;
double r37273105 = r37273103 / r37273104;
return r37273105;
}
double f(double x, double y) {
double r37273106 = x;
double r37273107 = -5.795611421145837e-17;
bool r37273108 = r37273106 <= r37273107;
double r37273109 = y;
double r37273110 = r37273106 - r37273109;
double r37273111 = r37273106 / r37273110;
double r37273112 = 2.0;
double r37273113 = r37273112 * r37273109;
double r37273114 = r37273111 * r37273113;
double r37273115 = 3.2475885478147857e-105;
bool r37273116 = r37273106 <= r37273115;
double r37273117 = 1.0;
double r37273118 = r37273110 / r37273109;
double r37273119 = r37273106 * r37273112;
double r37273120 = r37273118 / r37273119;
double r37273121 = r37273117 / r37273120;
double r37273122 = r37273116 ? r37273121 : r37273114;
double r37273123 = r37273108 ? r37273114 : r37273122;
return r37273123;
}




Bits error versus x




Bits error versus y
Results
| Original | 14.9 |
|---|---|
| Target | 0.4 |
| Herbie | 0.5 |
if x < -5.795611421145837e-17 or 3.2475885478147857e-105 < x Initial program 14.4
rmApplied associate-/l*12.6
rmApplied div-inv12.7
Applied times-frac0.8
Simplified0.7
if -5.795611421145837e-17 < x < 3.2475885478147857e-105Initial program 15.6
rmApplied associate-/l*0.0
rmApplied clear-num0.2
Final simplification0.5
herbie shell --seed 2019174 +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)))