\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -4.170166366739387040606763702320271963719 \cdot 10^{-10} \lor \neg \left(y \le 3.246088020282594653661448313913226129461 \cdot 10^{69}\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 r342685 = x;
double r342686 = 2.0;
double r342687 = r342685 * r342686;
double r342688 = y;
double r342689 = r342687 * r342688;
double r342690 = r342685 - r342688;
double r342691 = r342689 / r342690;
return r342691;
}
double f(double x, double y) {
double r342692 = y;
double r342693 = -4.170166366739387e-10;
bool r342694 = r342692 <= r342693;
double r342695 = 3.2460880202825947e+69;
bool r342696 = r342692 <= r342695;
double r342697 = !r342696;
bool r342698 = r342694 || r342697;
double r342699 = x;
double r342700 = 2.0;
double r342701 = r342699 * r342700;
double r342702 = r342699 - r342692;
double r342703 = r342702 / r342692;
double r342704 = r342701 / r342703;
double r342705 = r342701 / r342702;
double r342706 = r342705 * r342692;
double r342707 = r342698 ? r342704 : r342706;
return r342707;
}




Bits error versus x




Bits error versus y
Results
| Original | 14.6 |
|---|---|
| Target | 0.3 |
| Herbie | 0.2 |
if y < -4.170166366739387e-10 or 3.2460880202825947e+69 < y Initial program 16.6
rmApplied associate-/l*0.1
if -4.170166366739387e-10 < y < 3.2460880202825947e+69Initial program 12.8
rmApplied associate-/l*13.9
rmApplied associate-/r/0.3
Final simplification0.2
herbie shell --seed 2019305 +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)))