\frac{x + y}{\left(x \cdot 2\right) \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -6.70165043892356 \cdot 10^{62} \lor \neg \left(y \le 8348804843464008\right):\\
\;\;\;\;\frac{1}{x \cdot 2} \cdot \frac{x + y}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x + y}{x \cdot 2}}{y}\\
\end{array}double code(double x, double y) {
return ((double) (((double) (x + y)) / ((double) (((double) (x * 2.0)) * y))));
}
double code(double x, double y) {
double VAR;
if (((y <= -6.70165043892356e+62) || !(y <= 8348804843464008.0))) {
VAR = ((double) (((double) (1.0 / ((double) (x * 2.0)))) * ((double) (((double) (x + y)) / y))));
} else {
VAR = ((double) (((double) (((double) (x + y)) / ((double) (x * 2.0)))) / y));
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.0 |
|---|---|
| Target | 0.0 |
| Herbie | 0.3 |
if y < -6.70165043892356e62 or 8348804843464008 < y Initial program 16.6
rmApplied *-un-lft-identity16.6
Applied times-frac0.1
if -6.70165043892356e62 < y < 8348804843464008Initial program 13.8
rmApplied associate-/r*0.4
Final simplification0.3
herbie shell --seed 2020175
(FPCore (x y)
:name "Linear.Projection:inversePerspective from linear-1.19.1.3, C"
:precision binary64
:herbie-target
(+ (/ 0.5 x) (/ 0.5 y))
(/ (+ x y) (* (* x 2.0) y)))