\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.3381309335657303 \cdot 10^{+154}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -1.0184496907077957 \cdot 10^{-153}:\\
\;\;\;\;\frac{x \cdot x}{x \cdot x + y \cdot y} - \frac{y \cdot y}{x \cdot x + y \cdot y}\\
\mathbf{elif}\;y \le 3.4681229867935913 \cdot 10^{-162}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot x}{x \cdot x + y \cdot y} - \frac{y \cdot y}{x \cdot x + y \cdot y}\\
\end{array}double f(double x, double y) {
double r1276211 = x;
double r1276212 = y;
double r1276213 = r1276211 - r1276212;
double r1276214 = r1276211 + r1276212;
double r1276215 = r1276213 * r1276214;
double r1276216 = r1276211 * r1276211;
double r1276217 = r1276212 * r1276212;
double r1276218 = r1276216 + r1276217;
double r1276219 = r1276215 / r1276218;
return r1276219;
}
double f(double x, double y) {
double r1276220 = y;
double r1276221 = -1.3381309335657303e+154;
bool r1276222 = r1276220 <= r1276221;
double r1276223 = -1.0;
double r1276224 = -1.0184496907077957e-153;
bool r1276225 = r1276220 <= r1276224;
double r1276226 = x;
double r1276227 = r1276226 * r1276226;
double r1276228 = r1276220 * r1276220;
double r1276229 = r1276227 + r1276228;
double r1276230 = r1276227 / r1276229;
double r1276231 = r1276228 / r1276229;
double r1276232 = r1276230 - r1276231;
double r1276233 = 3.4681229867935913e-162;
bool r1276234 = r1276220 <= r1276233;
double r1276235 = 1.0;
double r1276236 = r1276234 ? r1276235 : r1276232;
double r1276237 = r1276225 ? r1276232 : r1276236;
double r1276238 = r1276222 ? r1276223 : r1276237;
return r1276238;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.8 |
|---|---|
| Target | 0.0 |
| Herbie | 5.1 |
if y < -1.3381309335657303e+154Initial program 63.6
Simplified63.6
Taylor expanded around 0 0
if -1.3381309335657303e+154 < y < -1.0184496907077957e-153 or 3.4681229867935913e-162 < y Initial program 0.0
Simplified0.0
Taylor expanded around inf 0.0
Simplified0.0
if -1.0184496907077957e-153 < y < 3.4681229867935913e-162Initial program 28.6
Simplified28.6
Taylor expanded around inf 28.6
Simplified28.6
Taylor expanded around -inf 15.7
Final simplification5.1
herbie shell --seed 2019151
(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))))