\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.3656303004097706 \cdot 10^{+154}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -7.522985421753554 \cdot 10^{-157}:\\
\;\;\;\;\left(\frac{x}{\sqrt{x \cdot x + y \cdot y}} - \sqrt{\frac{y \cdot y}{x \cdot x + y \cdot y}}\right) \cdot \left(\sqrt{\frac{y \cdot y}{x \cdot x + y \cdot y}} + \frac{x}{\sqrt{x \cdot x + y \cdot y}}\right)\\
\mathbf{elif}\;y \le 1.9144746578538855 \cdot 10^{-162}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x + y \cdot y}{x \cdot x}} - \frac{y \cdot y}{x \cdot x + y \cdot y}\\
\end{array}double f(double x, double y) {
double r4099284 = x;
double r4099285 = y;
double r4099286 = r4099284 - r4099285;
double r4099287 = r4099284 + r4099285;
double r4099288 = r4099286 * r4099287;
double r4099289 = r4099284 * r4099284;
double r4099290 = r4099285 * r4099285;
double r4099291 = r4099289 + r4099290;
double r4099292 = r4099288 / r4099291;
return r4099292;
}
double f(double x, double y) {
double r4099293 = y;
double r4099294 = -1.3656303004097706e+154;
bool r4099295 = r4099293 <= r4099294;
double r4099296 = -1.0;
double r4099297 = -7.522985421753554e-157;
bool r4099298 = r4099293 <= r4099297;
double r4099299 = x;
double r4099300 = r4099299 * r4099299;
double r4099301 = r4099293 * r4099293;
double r4099302 = r4099300 + r4099301;
double r4099303 = sqrt(r4099302);
double r4099304 = r4099299 / r4099303;
double r4099305 = r4099301 / r4099302;
double r4099306 = sqrt(r4099305);
double r4099307 = r4099304 - r4099306;
double r4099308 = r4099306 + r4099304;
double r4099309 = r4099307 * r4099308;
double r4099310 = 1.9144746578538855e-162;
bool r4099311 = r4099293 <= r4099310;
double r4099312 = 1.0;
double r4099313 = r4099302 / r4099300;
double r4099314 = r4099312 / r4099313;
double r4099315 = r4099314 - r4099305;
double r4099316 = r4099311 ? r4099312 : r4099315;
double r4099317 = r4099298 ? r4099309 : r4099316;
double r4099318 = r4099295 ? r4099296 : r4099317;
return r4099318;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.8 |
|---|---|
| Target | 0.0 |
| Herbie | 5.1 |
if y < -1.3656303004097706e+154Initial program 63.6
Simplified63.6
Taylor expanded around 0 0
if -1.3656303004097706e+154 < y < -7.522985421753554e-157Initial program 0.0
Simplified0.0
rmApplied add-sqr-sqrt0.0
Applied add-sqr-sqrt0.0
Applied times-frac0.0
Applied difference-of-squares0.0
if -7.522985421753554e-157 < y < 1.9144746578538855e-162Initial program 28.2
Simplified28.2
rmApplied clear-num28.2
Taylor expanded around -inf 16.1
if 1.9144746578538855e-162 < y Initial program 0.1
Simplified0.1
rmApplied clear-num0.1
Final simplification5.1
herbie shell --seed 2019144
(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))))