\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -163097.3914422508678399026393890380859375 \lor \neg \left(y \le 8.194716042463525833527836867452398528298 \cdot 10^{-21}\right):\\
\;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x - y} \cdot \left(y \cdot 2\right)\\
\end{array}double f(double x, double y) {
double r766991 = x;
double r766992 = 2.0;
double r766993 = r766991 * r766992;
double r766994 = y;
double r766995 = r766993 * r766994;
double r766996 = r766991 - r766994;
double r766997 = r766995 / r766996;
return r766997;
}
double f(double x, double y) {
double r766998 = y;
double r766999 = -163097.39144225087;
bool r767000 = r766998 <= r766999;
double r767001 = 8.194716042463526e-21;
bool r767002 = r766998 <= r767001;
double r767003 = !r767002;
bool r767004 = r767000 || r767003;
double r767005 = x;
double r767006 = 2.0;
double r767007 = r767005 * r767006;
double r767008 = r767005 - r766998;
double r767009 = r766998 / r767008;
double r767010 = r767007 * r767009;
double r767011 = r767005 / r767008;
double r767012 = r766998 * r767006;
double r767013 = r767011 * r767012;
double r767014 = r767004 ? r767010 : r767013;
return r767014;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.1 |
|---|---|
| Target | 0.4 |
| Herbie | 0.1 |
if y < -163097.39144225087 or 8.194716042463526e-21 < y Initial program 16.5
rmApplied *-un-lft-identity16.5
Applied times-frac0.1
Simplified0.1
if -163097.39144225087 < y < 8.194716042463526e-21Initial program 13.7
rmApplied associate-/l*15.6
rmApplied div-inv15.7
Applied times-frac0.2
Simplified0.0
Final simplification0.1
herbie shell --seed 2019353
(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)))