\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -106.3060688461918488201263244263827800751:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -1.112954613077047722664131657642916967389 \cdot 10^{-151} \lor \neg \left(y \le 7.168109854324841883368591954908086893719 \cdot 10^{-160}\right):\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + {y}^{2}}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}double f(double x, double y) {
double r72515 = x;
double r72516 = y;
double r72517 = r72515 - r72516;
double r72518 = r72515 + r72516;
double r72519 = r72517 * r72518;
double r72520 = r72515 * r72515;
double r72521 = r72516 * r72516;
double r72522 = r72520 + r72521;
double r72523 = r72519 / r72522;
return r72523;
}
double f(double x, double y) {
double r72524 = y;
double r72525 = -106.30606884619185;
bool r72526 = r72524 <= r72525;
double r72527 = -1.0;
double r72528 = -1.1129546130770477e-151;
bool r72529 = r72524 <= r72528;
double r72530 = 7.168109854324842e-160;
bool r72531 = r72524 <= r72530;
double r72532 = !r72531;
bool r72533 = r72529 || r72532;
double r72534 = x;
double r72535 = r72534 - r72524;
double r72536 = r72534 + r72524;
double r72537 = r72535 * r72536;
double r72538 = r72534 * r72534;
double r72539 = 2.0;
double r72540 = pow(r72524, r72539);
double r72541 = r72538 + r72540;
double r72542 = r72537 / r72541;
double r72543 = 1.0;
double r72544 = r72533 ? r72542 : r72543;
double r72545 = r72526 ? r72527 : r72544;
return r72545;
}




Bits error versus x




Bits error versus y
Results
| Original | 19.9 |
|---|---|
| Target | 0.1 |
| Herbie | 5.2 |
if y < -106.30606884619185Initial program 31.8
Taylor expanded around 0 31.8
Simplified31.8
rmApplied clear-num31.8
Taylor expanded around 0 0
if -106.30606884619185 < y < -1.1129546130770477e-151 or 7.168109854324842e-160 < y Initial program 0.0
Taylor expanded around 0 0.0
Simplified0.0
if -1.1129546130770477e-151 < y < 7.168109854324842e-160Initial program 28.5
Taylor expanded around 0 28.5
Simplified28.5
rmApplied clear-num28.5
Taylor expanded around inf 15.7
Final simplification5.2
herbie shell --seed 2019323
(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))))