\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -9.561120846059961 \cdot 10^{153}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -1.89985753242773941 \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 3.23597648055595592 \cdot 10^{-171}:\\
\;\;\;\;\frac{1}{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 r70259 = x;
double r70260 = y;
double r70261 = r70259 - r70260;
double r70262 = r70259 + r70260;
double r70263 = r70261 * r70262;
double r70264 = r70259 * r70259;
double r70265 = r70260 * r70260;
double r70266 = r70264 + r70265;
double r70267 = r70263 / r70266;
return r70267;
}
double f(double x, double y) {
double r70268 = y;
double r70269 = -9.561120846059961e+153;
bool r70270 = r70268 <= r70269;
double r70271 = -1.0;
double r70272 = -1.8998575324277394e-162;
bool r70273 = r70268 <= r70272;
double r70274 = 1.0;
double r70275 = x;
double r70276 = r70275 * r70275;
double r70277 = r70268 * r70268;
double r70278 = r70276 + r70277;
double r70279 = r70275 - r70268;
double r70280 = r70275 + r70268;
double r70281 = r70279 * r70280;
double r70282 = r70278 / r70281;
double r70283 = r70274 / r70282;
double r70284 = 3.235976480555956e-171;
bool r70285 = r70268 <= r70284;
double r70286 = r70274 / r70274;
double r70287 = r70285 ? r70286 : r70283;
double r70288 = r70273 ? r70283 : r70287;
double r70289 = r70270 ? r70271 : r70288;
return r70289;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.9 |
|---|---|
| Target | 0.1 |
| Herbie | 5.0 |
if y < -9.561120846059961e+153Initial program 64.0
Taylor expanded around 0 0
if -9.561120846059961e+153 < y < -1.8998575324277394e-162 or 3.235976480555956e-171 < y Initial program 0.5
rmApplied clear-num0.5
if -1.8998575324277394e-162 < y < 3.235976480555956e-171Initial program 31.1
rmApplied clear-num31.1
Taylor expanded around inf 15.5
Final simplification5.0
herbie shell --seed 2020039
(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))))