\frac{x - y}{\left(x \cdot 2\right) \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -2.85153879778384713 \cdot 10^{-58} \lor \neg \left(y \le 3.39728574246810265 \cdot 10^{-67}\right):\\
\;\;\;\;\frac{\frac{x}{y} - 1}{x \cdot 2}\\
\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 <= -2.851538797783847e-58) || !(y <= 3.3972857424681027e-67))) {
VAR = ((double) (((double) (((double) (x / y)) - 1.0)) / ((double) (x * 2.0))));
} 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.5 |
|---|---|
| Target | 0.0 |
| Herbie | 0.3 |
if y < -2.85153879778384713e-58 or 3.39728574246810265e-67 < y Initial program 13.5
rmApplied *-un-lft-identity13.5
Applied times-frac0.6
rmApplied associate-*l/0.5
Simplified0.5
rmApplied div-sub0.5
Simplified0.5
if -2.85153879778384713e-58 < y < 3.39728574246810265e-67Initial program 18.6
rmApplied associate-/r*0.1
Final simplification0.3
herbie shell --seed 2020153
(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)))