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




Bits error versus x




Bits error versus y
Results
| Original | 15.2 |
|---|---|
| Target | 0.0 |
| Herbie | 0.8 |
if y < -6.80562597648927385e120 or 2.73343986558032774e-12 < y Initial program 17.7
rmApplied *-un-lft-identity17.7
Applied times-frac0.1
Simplified0.1
if -6.80562597648927385e120 < y < 2.73343986558032774e-12Initial program 13.4
rmApplied associate-/r*1.2
Final simplification0.8
herbie shell --seed 2020182
(FPCore (x y)
:name "Linear.Projection:inversePerspective from linear-1.19.1.3, B"
:precision binary64
:herbie-target
(- (/ 0.5 y) (/ 0.5 x))
(/ (- x y) (* (* x 2.0) y)))