\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -3.658988851323816306303491351742974655897 \cdot 10^{150}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -1.660304854296606245768089281383148543308 \cdot 10^{-162}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x + y \cdot y}{\left(x - y\right) \cdot \left(x + y\right)}}\\
\mathbf{elif}\;y \le 1.955059603474676626176360228974583883699 \cdot 10^{-171}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x + y \cdot y}{\left(x - y\right) \cdot \left(x + y\right)}}\\
\end{array}double f(double x, double y) {
double r46303 = x;
double r46304 = y;
double r46305 = r46303 - r46304;
double r46306 = r46303 + r46304;
double r46307 = r46305 * r46306;
double r46308 = r46303 * r46303;
double r46309 = r46304 * r46304;
double r46310 = r46308 + r46309;
double r46311 = r46307 / r46310;
return r46311;
}
double f(double x, double y) {
double r46312 = y;
double r46313 = -3.658988851323816e+150;
bool r46314 = r46312 <= r46313;
double r46315 = -1.0;
double r46316 = -1.6603048542966062e-162;
bool r46317 = r46312 <= r46316;
double r46318 = 1.0;
double r46319 = x;
double r46320 = r46319 * r46319;
double r46321 = r46312 * r46312;
double r46322 = r46320 + r46321;
double r46323 = r46319 - r46312;
double r46324 = r46319 + r46312;
double r46325 = r46323 * r46324;
double r46326 = r46322 / r46325;
double r46327 = r46318 / r46326;
double r46328 = 1.9550596034746766e-171;
bool r46329 = r46312 <= r46328;
double r46330 = r46329 ? r46318 : r46327;
double r46331 = r46317 ? r46327 : r46330;
double r46332 = r46314 ? r46315 : r46331;
return r46332;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.4 |
|---|---|
| Target | 0.1 |
| Herbie | 5.4 |
if y < -3.658988851323816e+150Initial program 62.8
rmApplied clear-num62.8
rmApplied *-un-lft-identity62.8
Applied times-frac60.8
Applied add-sqr-sqrt60.8
Applied times-frac60.8
Simplified60.8
Simplified60.8
Taylor expanded around 0 0
if -3.658988851323816e+150 < y < -1.6603048542966062e-162 or 1.9550596034746766e-171 < y Initial program 0.6
rmApplied clear-num0.6
if -1.6603048542966062e-162 < y < 1.9550596034746766e-171Initial program 30.5
Taylor expanded around inf 16.3
Final simplification5.4
herbie shell --seed 2019298
(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))))