\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -7.746127243143355974810094617686649809789 \cdot 10^{90} \lor \neg \left(y \le 9.249259069239695741011081415304173923832 \cdot 10^{-66}\right):\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{x - y} \cdot y\\
\end{array}double f(double x, double y) {
double r652659 = x;
double r652660 = 2.0;
double r652661 = r652659 * r652660;
double r652662 = y;
double r652663 = r652661 * r652662;
double r652664 = r652659 - r652662;
double r652665 = r652663 / r652664;
return r652665;
}
double f(double x, double y) {
double r652666 = y;
double r652667 = -7.746127243143356e+90;
bool r652668 = r652666 <= r652667;
double r652669 = 9.249259069239696e-66;
bool r652670 = r652666 <= r652669;
double r652671 = !r652670;
bool r652672 = r652668 || r652671;
double r652673 = x;
double r652674 = 2.0;
double r652675 = r652673 * r652674;
double r652676 = r652673 - r652666;
double r652677 = r652676 / r652666;
double r652678 = r652675 / r652677;
double r652679 = r652675 / r652676;
double r652680 = r652679 * r652666;
double r652681 = r652672 ? r652678 : r652680;
return r652681;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.2 |
|---|---|
| Target | 0.3 |
| Herbie | 0.5 |
if y < -7.746127243143356e+90 or 9.249259069239696e-66 < y Initial program 16.9
rmApplied associate-/l*0.4
if -7.746127243143356e+90 < y < 9.249259069239696e-66Initial program 13.6
rmApplied associate-/l*13.9
rmApplied associate-/r/0.5
Final simplification0.5
herbie shell --seed 2019209 +o rules:numerics
(FPCore (x y)
:name "Linear.Projection:perspective from linear-1.19.1.3, B"
:precision binary64
:herbie-target
(if (< x -1.7210442634149447e81) (* (/ (* 2 x) (- x y)) y) (if (< x 83645045635564432) (/ (* x 2) (/ (- x y) y)) (* (/ (* 2 x) (- x y)) y)))
(/ (* (* x 2) y) (- x y)))