\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 r519957 = x;
double r519958 = 2.0;
double r519959 = r519957 * r519958;
double r519960 = y;
double r519961 = r519959 * r519960;
double r519962 = r519957 - r519960;
double r519963 = r519961 / r519962;
return r519963;
}
double f(double x, double y) {
double r519964 = y;
double r519965 = -1.8379060927151348e+37;
bool r519966 = r519964 <= r519965;
double r519967 = 2.535580169146477e-106;
bool r519968 = r519964 <= r519967;
double r519969 = !r519968;
bool r519970 = r519966 || r519969;
double r519971 = x;
double r519972 = 2.0;
double r519973 = r519971 * r519972;
double r519974 = r519971 - r519964;
double r519975 = r519964 / r519974;
double r519976 = r519973 * r519975;
double r519977 = r519973 / r519974;
double r519978 = r519977 * r519964;
double r519979 = r519970 ? r519976 : r519978;
return r519979;
}




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 +o rules:numerics
(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)))