\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \leq -2.4543606734273243 \cdot 10^{-132}:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\
\mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \leq -1.8649338853222587 \cdot 10^{-293}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\
\mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \leq 0:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\
\mathbf{elif}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \leq 9.2288577322726 \cdot 10^{-101}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\
\end{array}(FPCore (x y) :precision binary64 (/ (* (* x 2.0) y) (- x y)))
(FPCore (x y)
:precision binary64
(if (<= (/ (* (* x 2.0) y) (- x y)) -2.4543606734273243e-132)
(/ (* x 2.0) (/ (- x y) y))
(if (<= (/ (* (* x 2.0) y) (- x y)) -1.8649338853222587e-293)
(/ (* (* x 2.0) y) (- x y))
(if (<= (/ (* (* x 2.0) y) (- x y)) 0.0)
(/ (* x 2.0) (/ (- x y) y))
(if (<= (/ (* (* x 2.0) y) (- x y)) 9.2288577322726e-101)
(/ (* (* x 2.0) y) (- x y))
(* (* x 2.0) (/ y (- x y))))))))double code(double x, double y) {
return ((x * 2.0) * y) / (x - y);
}
double code(double x, double y) {
double tmp;
if ((((x * 2.0) * y) / (x - y)) <= -2.4543606734273243e-132) {
tmp = (x * 2.0) / ((x - y) / y);
} else if ((((x * 2.0) * y) / (x - y)) <= -1.8649338853222587e-293) {
tmp = ((x * 2.0) * y) / (x - y);
} else if ((((x * 2.0) * y) / (x - y)) <= 0.0) {
tmp = (x * 2.0) / ((x - y) / y);
} else if ((((x * 2.0) * y) / (x - y)) <= 9.2288577322726e-101) {
tmp = ((x * 2.0) * y) / (x - y);
} else {
tmp = (x * 2.0) * (y / (x - y));
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.3 |
|---|---|
| Target | 0.3 |
| Herbie | 1.6 |
if (/.f64 (*.f64 (*.f64 x 2) y) (-.f64 x y)) < -2.4543606734273243e-132 or -1.8649338853222587e-293 < (/.f64 (*.f64 (*.f64 x 2) y) (-.f64 x y)) < -0.0Initial program 28.3
rmApplied associate-/l*_binary64_138412.4
if -2.4543606734273243e-132 < (/.f64 (*.f64 (*.f64 x 2) y) (-.f64 x y)) < -1.8649338853222587e-293 or -0.0 < (/.f64 (*.f64 (*.f64 x 2) y) (-.f64 x y)) < 9.2288577322726003e-101Initial program 0.8
if 9.2288577322726003e-101 < (/.f64 (*.f64 (*.f64 x 2) y) (-.f64 x y)) Initial program 18.3
rmApplied *-un-lft-identity_binary64_1389418.3
Applied times-frac_binary64_139001.6
Simplified1.6
Final simplification1.6
herbie shell --seed 2020281
(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)))