\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.33482155704522383 \cdot 10^{154}:\\
\;\;\;\;\frac{x - y}{y - x}\\
\mathbf{elif}\;y \le -2.3154031063993499 \cdot 10^{-154}:\\
\;\;\;\;\frac{\frac{x - y}{\sqrt{{x}^{2} + {y}^{2}}}}{\frac{\sqrt{{x}^{2} + {y}^{2}}}{x + y}}\\
\mathbf{elif}\;y \le 2.69542421539970603 \cdot 10^{-162}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x - y}{\sqrt{{x}^{2} + {y}^{2}}}}{\sqrt[3]{{\left(\frac{\sqrt{{x}^{2} + {y}^{2}}}{x + y}\right)}^{3}}}\\
\end{array}double f(double x, double y) {
double r89929 = x;
double r89930 = y;
double r89931 = r89929 - r89930;
double r89932 = r89929 + r89930;
double r89933 = r89931 * r89932;
double r89934 = r89929 * r89929;
double r89935 = r89930 * r89930;
double r89936 = r89934 + r89935;
double r89937 = r89933 / r89936;
return r89937;
}
double f(double x, double y) {
double r89938 = y;
double r89939 = -1.3348215570452238e+154;
bool r89940 = r89938 <= r89939;
double r89941 = x;
double r89942 = r89941 - r89938;
double r89943 = r89938 - r89941;
double r89944 = r89942 / r89943;
double r89945 = -2.31540310639935e-154;
bool r89946 = r89938 <= r89945;
double r89947 = 2.0;
double r89948 = pow(r89941, r89947);
double r89949 = pow(r89938, r89947);
double r89950 = r89948 + r89949;
double r89951 = sqrt(r89950);
double r89952 = r89942 / r89951;
double r89953 = r89941 + r89938;
double r89954 = r89951 / r89953;
double r89955 = r89952 / r89954;
double r89956 = 2.695424215399706e-162;
bool r89957 = r89938 <= r89956;
double r89958 = 1.0;
double r89959 = 3.0;
double r89960 = pow(r89954, r89959);
double r89961 = cbrt(r89960);
double r89962 = r89952 / r89961;
double r89963 = r89957 ? r89958 : r89962;
double r89964 = r89946 ? r89955 : r89963;
double r89965 = r89940 ? r89944 : r89964;
return r89965;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.7 |
|---|---|
| Target | 0.1 |
| Herbie | 5.4 |
if y < -1.3348215570452238e+154Initial program 64.0
rmApplied associate-/l*62.0
Simplified62.0
Taylor expanded around 0 0
if -1.3348215570452238e+154 < y < -2.31540310639935e-154Initial program 0.0
rmApplied associate-/l*0.1
Simplified0.1
rmApplied *-un-lft-identity0.1
Applied add-sqr-sqrt0.1
Applied times-frac0.0
Applied associate-/r*0.0
Simplified0.0
if -2.31540310639935e-154 < y < 2.695424215399706e-162Initial program 28.7
Taylor expanded around inf 15.9
if 2.695424215399706e-162 < y Initial program 0.1
rmApplied associate-/l*0.5
Simplified0.5
rmApplied *-un-lft-identity0.5
Applied add-sqr-sqrt0.5
Applied times-frac0.5
Applied associate-/r*0.5
Simplified0.5
rmApplied add-cbrt-cube14.5
Applied add-cbrt-cube13.6
Applied cbrt-undiv13.6
Simplified0.5
Final simplification5.4
herbie shell --seed 2020035
(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))))