\frac{x + y}{\left(x \cdot 2\right) \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -2.3802292164302602 \cdot 10^{113} \lor \neg \left(y \le 7.44944977064311927 \cdot 10^{36}\right):\\
\;\;\;\;\frac{1}{x \cdot 2} \cdot \frac{x + y}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{0.5 \cdot \frac{y}{x} + 0.5}{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 <= -2.38022921643026e+113) || !(y <= 7.449449770643119e+36))) {
VAR = ((double) ((1.0 / ((double) (x * 2.0))) * (((double) (x + y)) / y)));
} else {
VAR = (((double) (((double) (0.5 * (y / x))) + 0.5)) / y);
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.5 |
|---|---|
| Target | 0.0 |
| Herbie | 0.7 |
if y < -2.3802292164302602e113 or 7.44944977064311927e36 < y Initial program 18.9
rmApplied *-un-lft-identity18.9
Applied times-frac0.1
if -2.3802292164302602e113 < y < 7.44944977064311927e36Initial program 13.5
rmApplied associate-/r*1.1
Taylor expanded around 0 1.0
Final simplification0.7
herbie shell --seed 2020181
(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)))