\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;x \le -9761946362776926507016235515904:\\
\;\;\;\;\left(y \cdot 2\right) \cdot \frac{x}{x - y}\\
\mathbf{elif}\;x \le 3.45921811371722128919155174305014492874 \cdot 10^{-46}:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot 2\right) \cdot \frac{x}{x - y}\\
\end{array}double f(double x, double y) {
double r22565084 = x;
double r22565085 = 2.0;
double r22565086 = r22565084 * r22565085;
double r22565087 = y;
double r22565088 = r22565086 * r22565087;
double r22565089 = r22565084 - r22565087;
double r22565090 = r22565088 / r22565089;
return r22565090;
}
double f(double x, double y) {
double r22565091 = x;
double r22565092 = -9.761946362776927e+30;
bool r22565093 = r22565091 <= r22565092;
double r22565094 = y;
double r22565095 = 2.0;
double r22565096 = r22565094 * r22565095;
double r22565097 = r22565091 - r22565094;
double r22565098 = r22565091 / r22565097;
double r22565099 = r22565096 * r22565098;
double r22565100 = 3.4592181137172213e-46;
bool r22565101 = r22565091 <= r22565100;
double r22565102 = r22565091 * r22565095;
double r22565103 = r22565097 / r22565094;
double r22565104 = r22565102 / r22565103;
double r22565105 = r22565101 ? r22565104 : r22565099;
double r22565106 = r22565093 ? r22565099 : r22565105;
return r22565106;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.2 |
|---|---|
| Target | 0.2 |
| Herbie | 0.2 |
if x < -9.761946362776927e+30 or 3.4592181137172213e-46 < x Initial program 15.6
rmApplied associate-/l*14.4
rmApplied div-inv14.5
Applied times-frac0.4
Simplified0.3
if -9.761946362776927e+30 < x < 3.4592181137172213e-46Initial program 14.8
rmApplied associate-/l*0.1
Final simplification0.2
herbie shell --seed 2019192 +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)))