\frac{x + y}{\left(x \cdot 2\right) \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.79882819304230529 \cdot 10^{47} \lor \neg \left(y \le 3.09619529082247742 \cdot 10^{47}\right):\\
\;\;\;\;\frac{1}{x \cdot 2} \cdot \frac{y + x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{y \cdot \frac{x}{\frac{y + x}{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.7988281930423053e+47) || !(y <= 3.0961952908224774e+47))) {
VAR = ((double) (((double) (1.0 / ((double) (x * 2.0)))) * ((double) (((double) (y + x)) / y))));
} else {
VAR = ((double) (1.0 / ((double) (y * ((double) (x / ((double) (((double) (y + x)) / 2.0))))))));
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.2 |
|---|---|
| Target | 0.0 |
| Herbie | 0.2 |
if y < -1.79882819304230529e47 or 3.09619529082247742e47 < y Initial program 17.5
rmApplied *-un-lft-identity17.5
Applied times-frac0.1
if -1.79882819304230529e47 < y < 3.09619529082247742e47Initial program 13.5
rmApplied clear-num13.4
Simplified0.4
Final simplification0.2
herbie shell --seed 2020179
(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)))