\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.510563131011509312029961642974820488385 \cdot 10^{145}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -4.381918288171490541810968390394686030288 \cdot 10^{-146}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x + y \cdot y}{x \cdot x - y \cdot y}}\\
\mathbf{elif}\;y \le 8.251127577565226646325837783638255523843 \cdot 10^{-164}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x + y \cdot y}{x \cdot x - y \cdot y}}\\
\end{array}double f(double x, double y) {
double r5639399 = x;
double r5639400 = y;
double r5639401 = r5639399 - r5639400;
double r5639402 = r5639399 + r5639400;
double r5639403 = r5639401 * r5639402;
double r5639404 = r5639399 * r5639399;
double r5639405 = r5639400 * r5639400;
double r5639406 = r5639404 + r5639405;
double r5639407 = r5639403 / r5639406;
return r5639407;
}
double f(double x, double y) {
double r5639408 = y;
double r5639409 = -1.5105631310115093e+145;
bool r5639410 = r5639408 <= r5639409;
double r5639411 = -1.0;
double r5639412 = -4.3819182881714905e-146;
bool r5639413 = r5639408 <= r5639412;
double r5639414 = 1.0;
double r5639415 = x;
double r5639416 = r5639415 * r5639415;
double r5639417 = r5639408 * r5639408;
double r5639418 = r5639416 + r5639417;
double r5639419 = r5639416 - r5639417;
double r5639420 = r5639418 / r5639419;
double r5639421 = r5639414 / r5639420;
double r5639422 = 8.251127577565227e-164;
bool r5639423 = r5639408 <= r5639422;
double r5639424 = r5639423 ? r5639414 : r5639421;
double r5639425 = r5639413 ? r5639421 : r5639424;
double r5639426 = r5639410 ? r5639411 : r5639425;
return r5639426;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.5 |
|---|---|
| Target | 0.1 |
| Herbie | 5.3 |
if y < -1.5105631310115093e+145Initial program 60.5
Taylor expanded around 0 0
if -1.5105631310115093e+145 < y < -4.3819182881714905e-146 or 8.251127577565227e-164 < y Initial program 0.1
rmApplied clear-num0.1
Simplified0.1
if -4.3819182881714905e-146 < y < 8.251127577565227e-164Initial program 29.0
Taylor expanded around inf 16.1
Final simplification5.3
herbie shell --seed 2019169
(FPCore (x y)
:name "Kahan p9 Example"
:pre (and (< 0.0 x 1.0) (< y 1.0))
:herbie-target
(if (< 0.5 (fabs (/ x y)) 2.0) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) (- 1.0 (/ 2.0 (+ 1.0 (* (/ x y) (/ x y))))))
(/ (* (- x y) (+ x y)) (+ (* x x) (* y y))))