\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -6.28812736973600292546513463779144784486 \cdot 10^{77} \lor \neg \left(y \le 1.368390397641661343136755314604820394056 \cdot 10^{-94}\right):\\
\;\;\;\;\frac{x \cdot 2}{-1 + \frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{x - y} \cdot y\\
\end{array}double f(double x, double y) {
double r319669 = x;
double r319670 = 2.0;
double r319671 = r319669 * r319670;
double r319672 = y;
double r319673 = r319671 * r319672;
double r319674 = r319669 - r319672;
double r319675 = r319673 / r319674;
return r319675;
}
double f(double x, double y) {
double r319676 = y;
double r319677 = -6.288127369736003e+77;
bool r319678 = r319676 <= r319677;
double r319679 = 1.3683903976416613e-94;
bool r319680 = r319676 <= r319679;
double r319681 = !r319680;
bool r319682 = r319678 || r319681;
double r319683 = x;
double r319684 = 2.0;
double r319685 = r319683 * r319684;
double r319686 = -1.0;
double r319687 = r319683 / r319676;
double r319688 = r319686 + r319687;
double r319689 = r319685 / r319688;
double r319690 = r319683 - r319676;
double r319691 = r319685 / r319690;
double r319692 = r319691 * r319676;
double r319693 = r319682 ? r319689 : r319692;
return r319693;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.0 |
|---|---|
| Target | 0.3 |
| Herbie | 0.6 |
if y < -6.288127369736003e+77 or 1.3683903976416613e-94 < y Initial program 15.5
rmApplied associate-/l*0.8
Taylor expanded around 0 0.8
Simplified0.8
if -6.288127369736003e+77 < y < 1.3683903976416613e-94Initial program 14.5
rmApplied associate-/l*14.4
rmApplied associate-/r/0.4
Final simplification0.6
herbie shell --seed 2019326 +o rules:numerics
(FPCore (x y)
:name "Linear.Projection:perspective from linear-1.19.1.3, B"
:precision binary64
:herbie-target
(if (< x -1.7210442634149447e+81) (* (/ (* 2 x) (- x y)) y) (if (< x 83645045635564432) (/ (* x 2) (/ (- x y) y)) (* (/ (* 2 x) (- x y)) y)))
(/ (* (* x 2) y) (- x y)))