\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -9.7481688320642468 \cdot 10^{142}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -2.8249914759998345 \cdot 10^{-162}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x + y \cdot y}{\left(x - y\right) \cdot \left(x + y\right)}}\\
\mathbf{elif}\;y \le 1.576932748768084 \cdot 10^{-162}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x + y \cdot y}{\left(x - y\right) \cdot \left(x + y\right)}}\\
\end{array}double f(double x, double y) {
double r90598 = x;
double r90599 = y;
double r90600 = r90598 - r90599;
double r90601 = r90598 + r90599;
double r90602 = r90600 * r90601;
double r90603 = r90598 * r90598;
double r90604 = r90599 * r90599;
double r90605 = r90603 + r90604;
double r90606 = r90602 / r90605;
return r90606;
}
double f(double x, double y) {
double r90607 = y;
double r90608 = -9.748168832064247e+142;
bool r90609 = r90607 <= r90608;
double r90610 = -1.0;
double r90611 = -2.8249914759998345e-162;
bool r90612 = r90607 <= r90611;
double r90613 = 1.0;
double r90614 = x;
double r90615 = r90614 * r90614;
double r90616 = r90607 * r90607;
double r90617 = r90615 + r90616;
double r90618 = r90614 - r90607;
double r90619 = r90614 + r90607;
double r90620 = r90618 * r90619;
double r90621 = r90617 / r90620;
double r90622 = r90613 / r90621;
double r90623 = 1.576932748768084e-162;
bool r90624 = r90607 <= r90623;
double r90625 = r90624 ? r90613 : r90622;
double r90626 = r90612 ? r90622 : r90625;
double r90627 = r90609 ? r90610 : r90626;
return r90627;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.3 |
|---|---|
| Target | 0.0 |
| Herbie | 5.0 |
if y < -9.748168832064247e+142Initial program 59.9
rmApplied add-sqr-sqrt59.9
Applied times-frac58.1
Taylor expanded around 0 0
if -9.748168832064247e+142 < y < -2.8249914759998345e-162 or 1.576932748768084e-162 < y Initial program 0.0
rmApplied clear-num0.0
if -2.8249914759998345e-162 < y < 1.576932748768084e-162Initial program 31.0
rmApplied add-sqr-sqrt31.0
Applied times-frac31.6
Taylor expanded around inf 16.1
Final simplification5.0
herbie shell --seed 2020020
(FPCore (x y)
:name "Kahan p9 Example"
:precision binary64
:pre (and (< 0.0 x 1) (< y 1))
:herbie-target
(if (< 0.5 (fabs (/ x y)) 2) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) (- 1 (/ 2 (+ 1 (* (/ x y) (/ x y))))))
(/ (* (- x y) (+ x y)) (+ (* x x) (* y y))))