\frac{x + y}{\left(x \cdot 2\right) \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.10625282481159711 \cdot 10^{-58} \lor \neg \left(y \le 1.39601892208603475 \cdot 10^{-57}\right):\\
\;\;\;\;\frac{\frac{-\left(x + y\right)}{y}}{-x \cdot 2}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y} \cdot \frac{x + y}{x \cdot 2}\\
\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 <= -1.1062528248115971e-58) || !(y <= 1.3960189220860347e-57))) {
VAR = ((double) (((double) (((double) -(((double) (x + y)))) / y)) / ((double) -(((double) (x * 2.0))))));
} else {
VAR = ((double) (((double) (1.0 / y)) * ((double) (((double) (x + y)) / ((double) (x * 2.0))))));
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 14.7 |
|---|---|
| Target | 0.0 |
| Herbie | 0.4 |
if y < -1.1062528248115971e-58 or 1.3960189220860347e-57 < y Initial program 12.8
rmApplied *-commutative12.8
Applied *-un-lft-identity12.8
Applied times-frac13.8
rmApplied frac-2neg13.8
Applied associate-*r/0.6
Simplified0.6
if -1.1062528248115971e-58 < y < 1.3960189220860347e-57Initial program 17.5
rmApplied *-commutative17.5
Applied *-un-lft-identity17.5
Applied times-frac0.1
Final simplification0.4
herbie shell --seed 2020114 +o rules:numerics
(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) y)))