\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -9.984365809073703929848708018230154758947 \cdot 10^{82} \lor \neg \left(y \le 6.617810863587314615453058275008041291286 \cdot 10^{-52}\right):\\
\;\;\;\;\frac{x \cdot 2}{\frac{x}{y} - 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{x - y} \cdot y\\
\end{array}double f(double x, double y) {
double r342783 = x;
double r342784 = 2.0;
double r342785 = r342783 * r342784;
double r342786 = y;
double r342787 = r342785 * r342786;
double r342788 = r342783 - r342786;
double r342789 = r342787 / r342788;
return r342789;
}
double f(double x, double y) {
double r342790 = y;
double r342791 = -9.984365809073704e+82;
bool r342792 = r342790 <= r342791;
double r342793 = 6.6178108635873146e-52;
bool r342794 = r342790 <= r342793;
double r342795 = !r342794;
bool r342796 = r342792 || r342795;
double r342797 = x;
double r342798 = 2.0;
double r342799 = r342797 * r342798;
double r342800 = r342797 / r342790;
double r342801 = 1.0;
double r342802 = r342800 - r342801;
double r342803 = r342799 / r342802;
double r342804 = r342797 - r342790;
double r342805 = r342799 / r342804;
double r342806 = r342805 * r342790;
double r342807 = r342796 ? r342803 : r342806;
return r342807;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.2 |
|---|---|
| Target | 0.3 |
| Herbie | 0.4 |
if y < -9.984365809073704e+82 or 6.6178108635873146e-52 < y Initial program 16.4
rmApplied associate-/l*0.5
rmApplied div-sub0.5
Simplified0.5
if -9.984365809073704e+82 < y < 6.6178108635873146e-52Initial program 14.1
rmApplied associate-/l*13.1
rmApplied associate-/r/0.4
Final simplification0.4
herbie shell --seed 2019303 +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)))