\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.05517634643658878 \cdot 10^{154}:\\
\;\;\;\;\frac{1}{-1}\\
\mathbf{elif}\;y \le -2.5188680969543457 \cdot 10^{-164}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x + y \cdot y}{\left(x - y\right) \cdot \left(x + y\right)}}\\
\mathbf{elif}\;y \le -3.9254647910815149 \cdot 10^{-187}:\\
\;\;\;\;\frac{1}{-1}\\
\mathbf{elif}\;y \le 2.18546991120475549 \cdot 10^{-162}:\\
\;\;\;\;\frac{1}{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 r90528 = x;
double r90529 = y;
double r90530 = r90528 - r90529;
double r90531 = r90528 + r90529;
double r90532 = r90530 * r90531;
double r90533 = r90528 * r90528;
double r90534 = r90529 * r90529;
double r90535 = r90533 + r90534;
double r90536 = r90532 / r90535;
return r90536;
}
double f(double x, double y) {
double r90537 = y;
double r90538 = -1.0551763464365888e+154;
bool r90539 = r90537 <= r90538;
double r90540 = 1.0;
double r90541 = -1.0;
double r90542 = r90540 / r90541;
double r90543 = -2.5188680969543457e-164;
bool r90544 = r90537 <= r90543;
double r90545 = x;
double r90546 = r90545 * r90545;
double r90547 = r90537 * r90537;
double r90548 = r90546 + r90547;
double r90549 = r90545 - r90537;
double r90550 = r90545 + r90537;
double r90551 = r90549 * r90550;
double r90552 = r90548 / r90551;
double r90553 = r90540 / r90552;
double r90554 = -3.925464791081515e-187;
bool r90555 = r90537 <= r90554;
double r90556 = 2.1854699112047555e-162;
bool r90557 = r90537 <= r90556;
double r90558 = r90540 / r90540;
double r90559 = r90557 ? r90558 : r90553;
double r90560 = r90555 ? r90542 : r90559;
double r90561 = r90544 ? r90553 : r90560;
double r90562 = r90539 ? r90542 : r90561;
return r90562;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.2 |
|---|---|
| Target | 0.1 |
| Herbie | 5.0 |
if y < -1.0551763464365888e+154 or -2.5188680969543457e-164 < y < -3.925464791081515e-187Initial program 60.2
rmApplied clear-num60.2
Taylor expanded around 0 4.1
if -1.0551763464365888e+154 < y < -2.5188680969543457e-164 or 2.1854699112047555e-162 < y Initial program 0.2
rmApplied clear-num0.2
if -3.925464791081515e-187 < y < 2.1854699112047555e-162Initial program 29.0
rmApplied clear-num29.0
Taylor expanded around inf 14.0
Final simplification5.0
herbie shell --seed 2020062
(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))))