\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -1.8379060927151348 \cdot 10^{37} \lor \neg \left(y \le 2.53558016914647718 \cdot 10^{-106}\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 r450940 = x;
double r450941 = 2.0;
double r450942 = r450940 * r450941;
double r450943 = y;
double r450944 = r450942 * r450943;
double r450945 = r450940 - r450943;
double r450946 = r450944 / r450945;
return r450946;
}
double f(double x, double y) {
double r450947 = y;
double r450948 = -1.8379060927151348e+37;
bool r450949 = r450947 <= r450948;
double r450950 = 2.535580169146477e-106;
bool r450951 = r450947 <= r450950;
double r450952 = !r450951;
bool r450953 = r450949 || r450952;
double r450954 = x;
double r450955 = 2.0;
double r450956 = r450954 * r450955;
double r450957 = r450954 - r450947;
double r450958 = r450947 / r450957;
double r450959 = r450956 * r450958;
double r450960 = r450956 / r450957;
double r450961 = r450960 * r450947;
double r450962 = r450953 ? r450959 : r450961;
return r450962;
}




Bits error versus x




Bits error versus y
Results
| Original | 14.7 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if y < -1.8379060927151348e+37 or 2.535580169146477e-106 < y Initial program 14.6
rmApplied *-un-lft-identity14.6
Applied times-frac0.6
Simplified0.6
if -1.8379060927151348e+37 < y < 2.535580169146477e-106Initial program 15.0
rmApplied associate-/l*15.6
rmApplied associate-/r/0.2
Final simplification0.4
herbie shell --seed 2020045
(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)))