\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -1.3377295553932065 \cdot 10^{+154}:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \le -3.6726164932126896 \cdot 10^{-218}:\\
\;\;\;\;\sqrt{y \cdot y + x \cdot x}\\
\mathbf{elif}\;x \le 1.590629195950438 \cdot 10^{-228}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \le 2.882396363471933 \cdot 10^{+117}:\\
\;\;\;\;\sqrt{y \cdot y + x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r15442421 = x;
double r15442422 = r15442421 * r15442421;
double r15442423 = y;
double r15442424 = r15442423 * r15442423;
double r15442425 = r15442422 + r15442424;
double r15442426 = sqrt(r15442425);
return r15442426;
}
double f(double x, double y) {
double r15442427 = x;
double r15442428 = -1.3377295553932065e+154;
bool r15442429 = r15442427 <= r15442428;
double r15442430 = -r15442427;
double r15442431 = -3.6726164932126896e-218;
bool r15442432 = r15442427 <= r15442431;
double r15442433 = y;
double r15442434 = r15442433 * r15442433;
double r15442435 = r15442427 * r15442427;
double r15442436 = r15442434 + r15442435;
double r15442437 = sqrt(r15442436);
double r15442438 = 1.590629195950438e-228;
bool r15442439 = r15442427 <= r15442438;
double r15442440 = 2.882396363471933e+117;
bool r15442441 = r15442427 <= r15442440;
double r15442442 = r15442441 ? r15442437 : r15442427;
double r15442443 = r15442439 ? r15442433 : r15442442;
double r15442444 = r15442432 ? r15442437 : r15442443;
double r15442445 = r15442429 ? r15442430 : r15442444;
return r15442445;
}




Bits error versus x




Bits error versus y
Results
| Original | 29.7 |
|---|---|
| Target | 16.9 |
| Herbie | 17.4 |
if x < -1.3377295553932065e+154Initial program 59.4
Taylor expanded around -inf 7.6
Simplified7.6
if -1.3377295553932065e+154 < x < -3.6726164932126896e-218 or 1.590629195950438e-228 < x < 2.882396363471933e+117Initial program 17.7
if -3.6726164932126896e-218 < x < 1.590629195950438e-228Initial program 29.3
Taylor expanded around 0 33.6
if 2.882396363471933e+117 < x Initial program 50.9
Taylor expanded around inf 9.4
Final simplification17.4
herbie shell --seed 2019156
(FPCore (x y)
:name "Data.Octree.Internal:octantDistance from Octree-0.5.4.2"
:herbie-target
(if (< x -1.1236950826599826e+145) (- x) (if (< x 1.116557621183362e+93) (sqrt (+ (* x x) (* y y))) x))
(sqrt (+ (* x x) (* y y))))