\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.3561015051531283 \cdot 10^{+154}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -2.0295842870860447 \cdot 10^{-160}:\\
\;\;\;\;\frac{1}{\frac{\mathsf{fma}\left(y, y, \left(x \cdot x\right)\right)}{\left(x - y\right) \cdot \left(y + x\right)}}\\
\mathbf{elif}\;y \le 4.593586257584354 \cdot 10^{-186}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\frac{x - y}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot y\right)\right)}{y + x}} \cdot \left(\frac{x - y}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot y\right)\right)}{y + x}} \cdot \frac{x - y}{\frac{\mathsf{fma}\left(x, x, \left(y \cdot y\right)\right)}{y + x}}\right)}\\
\end{array}double f(double x, double y) {
double r1927013 = x;
double r1927014 = y;
double r1927015 = r1927013 - r1927014;
double r1927016 = r1927013 + r1927014;
double r1927017 = r1927015 * r1927016;
double r1927018 = r1927013 * r1927013;
double r1927019 = r1927014 * r1927014;
double r1927020 = r1927018 + r1927019;
double r1927021 = r1927017 / r1927020;
return r1927021;
}
double f(double x, double y) {
double r1927022 = y;
double r1927023 = -1.3561015051531283e+154;
bool r1927024 = r1927022 <= r1927023;
double r1927025 = -1.0;
double r1927026 = -2.0295842870860447e-160;
bool r1927027 = r1927022 <= r1927026;
double r1927028 = 1.0;
double r1927029 = x;
double r1927030 = r1927029 * r1927029;
double r1927031 = fma(r1927022, r1927022, r1927030);
double r1927032 = r1927029 - r1927022;
double r1927033 = r1927022 + r1927029;
double r1927034 = r1927032 * r1927033;
double r1927035 = r1927031 / r1927034;
double r1927036 = r1927028 / r1927035;
double r1927037 = 4.593586257584354e-186;
bool r1927038 = r1927022 <= r1927037;
double r1927039 = r1927022 * r1927022;
double r1927040 = fma(r1927029, r1927029, r1927039);
double r1927041 = r1927040 / r1927033;
double r1927042 = r1927032 / r1927041;
double r1927043 = r1927042 * r1927042;
double r1927044 = r1927042 * r1927043;
double r1927045 = cbrt(r1927044);
double r1927046 = r1927038 ? r1927028 : r1927045;
double r1927047 = r1927027 ? r1927036 : r1927046;
double r1927048 = r1927024 ? r1927025 : r1927047;
return r1927048;
}




Bits error versus x




Bits error versus y
| Original | 20.5 |
|---|---|
| Target | 0.1 |
| Herbie | 5.3 |
if y < -1.3561015051531283e+154Initial program 63.6
Simplified63.6
Taylor expanded around 0 0
if -1.3561015051531283e+154 < y < -2.0295842870860447e-160Initial program 0.0
Simplified0.0
rmApplied clear-num0.0
if -2.0295842870860447e-160 < y < 4.593586257584354e-186Initial program 30.5
Simplified30.5
Taylor expanded around inf 14.9
if 4.593586257584354e-186 < y Initial program 4.3
Simplified4.3
rmApplied associate-/l*4.9
rmApplied add-cbrt-cube18.5
Applied add-cbrt-cube17.9
Applied cbrt-undiv17.8
Simplified4.8
Final simplification5.3
herbie shell --seed 2019130 +o rules:numerics
(FPCore (x y)
:name "Kahan p9 Example"
:pre (and (< 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))))