\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -106.8362219082959398974708165042102336884:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -7.718474411270338072989398491487506383281 \cdot 10^{-160} \lor \neg \left(y \le 2.115550490482853735977870448972948077296 \cdot 10^{-166}\right):\\
\;\;\;\;\frac{\frac{\left(x - y\right) \cdot \left(x + y\right)}{\sqrt{x \cdot x + y \cdot y}}}{\sqrt{x \cdot x + y \cdot y}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r65550 = x;
double r65551 = y;
double r65552 = r65550 - r65551;
double r65553 = r65550 + r65551;
double r65554 = r65552 * r65553;
double r65555 = r65550 * r65550;
double r65556 = r65551 * r65551;
double r65557 = r65555 + r65556;
double r65558 = r65554 / r65557;
return r65558;
}
double f(double x, double y) {
double r65559 = y;
double r65560 = -106.83622190829594;
bool r65561 = r65559 <= r65560;
double r65562 = -1.0;
double r65563 = -7.718474411270338e-160;
bool r65564 = r65559 <= r65563;
double r65565 = 2.1155504904828537e-166;
bool r65566 = r65559 <= r65565;
double r65567 = !r65566;
bool r65568 = r65564 || r65567;
double r65569 = x;
double r65570 = r65569 - r65559;
double r65571 = r65569 + r65559;
double r65572 = r65570 * r65571;
double r65573 = r65569 * r65569;
double r65574 = r65559 * r65559;
double r65575 = r65573 + r65574;
double r65576 = sqrt(r65575);
double r65577 = r65572 / r65576;
double r65578 = r65577 / r65576;
double r65579 = 1.0;
double r65580 = r65568 ? r65578 : r65579;
double r65581 = r65561 ? r65562 : r65580;
return r65581;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.4 |
|---|---|
| Target | 0.1 |
| Herbie | 5.0 |
if y < -106.83622190829594Initial program 33.1
Taylor expanded around 0 0.0
if -106.83622190829594 < y < -7.718474411270338e-160 or 2.1155504904828537e-166 < y Initial program 0.2
rmApplied add-sqr-sqrt0.3
Applied associate-/r*0.3
if -7.718474411270338e-160 < y < 2.1155504904828537e-166Initial program 29.2
rmApplied clear-num29.2
Taylor expanded around inf 15.3
Final simplification5.0
herbie shell --seed 2019322
(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))))