\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \leq -1.9395487420113406 \cdot 10^{-117}:\\
\;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\
\mathbf{elif}\;y \leq 2.068588027991875 \cdot 10^{-183}:\\
\;\;\;\;2 \cdot \frac{{y}^{2}}{x} + y \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\
\end{array}(FPCore (x y) :precision binary64 (/ (* (* x 2.0) y) (- x y)))
(FPCore (x y)
:precision binary64
(if (<= y -1.9395487420113406e-117)
(* (* x 2.0) (/ y (- x y)))
(if (<= y 2.068588027991875e-183)
(+ (* 2.0 (/ (pow y 2.0) x)) (* y 2.0))
(/ (* x 2.0) (/ (- x y) y)))))double code(double x, double y) {
return ((x * 2.0) * y) / (x - y);
}
double code(double x, double y) {
double tmp;
if (y <= -1.9395487420113406e-117) {
tmp = (x * 2.0) * (y / (x - y));
} else if (y <= 2.068588027991875e-183) {
tmp = (2.0 * (pow(y, 2.0) / x)) + (y * 2.0);
} else {
tmp = (x * 2.0) / ((x - y) / y);
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.4 |
|---|---|
| Target | 0.4 |
| Herbie | 3.9 |
if y < -1.93954874201134064e-117Initial program 14.0
rmApplied *-un-lft-identity_binary64_1371814.0
Applied times-frac_binary64_137241.4
if -1.93954874201134064e-117 < y < 2.0685880279918749e-183Initial program 20.2
Taylor expanded around inf 8.6
if 2.0685880279918749e-183 < y Initial program 13.5
rmApplied associate-/l*_binary64_136632.9
Final simplification3.9
herbie shell --seed 2021093
(FPCore (x y)
:name "Linear.Projection:perspective from linear-1.19.1.3, B"
:precision binary64
:herbie-target
(if (< x -1.7210442634149447e+81) (* (/ (* 2.0 x) (- x y)) y) (if (< x 8.364504563556443e+16) (/ (* x 2.0) (/ (- x y) y)) (* (/ (* 2.0 x) (- x y)) y)))
(/ (* (* x 2.0) y) (- x y)))