\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -5.9648958467837301 \cdot 10^{102}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le 3.49168277985170575 \cdot 10^{70}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r911929 = x;
double r911930 = r911929 * r911929;
double r911931 = y;
double r911932 = r911931 * r911931;
double r911933 = r911930 + r911932;
double r911934 = sqrt(r911933);
return r911934;
}
double f(double x, double y) {
double r911935 = x;
double r911936 = -5.96489584678373e+102;
bool r911937 = r911935 <= r911936;
double r911938 = -1.0;
double r911939 = r911938 * r911935;
double r911940 = 3.491682779851706e+70;
bool r911941 = r911935 <= r911940;
double r911942 = r911935 * r911935;
double r911943 = y;
double r911944 = r911943 * r911943;
double r911945 = r911942 + r911944;
double r911946 = sqrt(r911945);
double r911947 = r911941 ? r911946 : r911935;
double r911948 = r911937 ? r911939 : r911947;
return r911948;
}




Bits error versus x




Bits error versus y
Results
| Original | 32.0 |
|---|---|
| Target | 18.3 |
| Herbie | 18.4 |
if x < -5.96489584678373e+102Initial program 53.0
Taylor expanded around -inf 10.2
if -5.96489584678373e+102 < x < 3.491682779851706e+70Initial program 22.2
if 3.491682779851706e+70 < x Initial program 47.4
Taylor expanded around inf 12.5
Final simplification18.4
herbie shell --seed 2020089
(FPCore (x y)
:name "Data.Octree.Internal:octantDistance from Octree-0.5.4.2"
:precision binary64
:herbie-target
(if (< x -1.123695082659983e+145) (- x) (if (< x 1.116557621183362e+93) (sqrt (+ (* x x) (* y y))) x))
(sqrt (+ (* x x) (* y y))))