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




Bits error versus x




Bits error versus y
Results
| Original | 14.8 |
|---|---|
| Target | 0.0 |
| Herbie | 0.3 |
if x < -1.2137323963604039e-17 or 2.7674407540267516e-85 < x Initial program 12.8
rmApplied clear-num12.6
Simplified0.4
if -1.2137323963604039e-17 < x < 2.7674407540267516e-85Initial program 17.7
rmApplied *-un-lft-identity17.7
Applied times-frac0.1
Final simplification0.3
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)))