\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -1.1116518480520122 \cdot 10^{66} \lor \neg \left(y \le 3.6268085031482395 \cdot 10^{-63}\right):\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x - y} \cdot \left(y \cdot 2\right)\\
\end{array}double f(double x, double y) {
double r533640 = x;
double r533641 = 2.0;
double r533642 = r533640 * r533641;
double r533643 = y;
double r533644 = r533642 * r533643;
double r533645 = r533640 - r533643;
double r533646 = r533644 / r533645;
return r533646;
}
double f(double x, double y) {
double r533647 = y;
double r533648 = -1.1116518480520122e+66;
bool r533649 = r533647 <= r533648;
double r533650 = 3.6268085031482395e-63;
bool r533651 = r533647 <= r533650;
double r533652 = !r533651;
bool r533653 = r533649 || r533652;
double r533654 = x;
double r533655 = 2.0;
double r533656 = r533654 * r533655;
double r533657 = r533654 - r533647;
double r533658 = r533657 / r533647;
double r533659 = r533656 / r533658;
double r533660 = r533654 / r533657;
double r533661 = r533647 * r533655;
double r533662 = r533660 * r533661;
double r533663 = r533653 ? r533659 : r533662;
return r533663;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.5 |
|---|---|
| Target | 0.4 |
| Herbie | 0.4 |
if y < -1.1116518480520122e+66 or 3.6268085031482395e-63 < y Initial program 16.5
rmApplied associate-/l*0.5
if -1.1116518480520122e+66 < y < 3.6268085031482395e-63Initial program 14.4
rmApplied associate-/l*14.8
rmApplied div-inv14.9
Applied times-frac0.5
Simplified0.3
Final simplification0.4
herbie shell --seed 2020083
(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)))