\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -8.2785642049712221 \cdot 10^{77}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le 1.9891121466079622 \cdot 10^{116}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r755927 = x;
double r755928 = r755927 * r755927;
double r755929 = y;
double r755930 = r755929 * r755929;
double r755931 = r755928 + r755930;
double r755932 = sqrt(r755931);
return r755932;
}
double f(double x, double y) {
double r755933 = x;
double r755934 = -8.278564204971222e+77;
bool r755935 = r755933 <= r755934;
double r755936 = -1.0;
double r755937 = r755936 * r755933;
double r755938 = 1.9891121466079622e+116;
bool r755939 = r755933 <= r755938;
double r755940 = r755933 * r755933;
double r755941 = y;
double r755942 = r755941 * r755941;
double r755943 = r755940 + r755942;
double r755944 = sqrt(r755943);
double r755945 = r755939 ? r755944 : r755933;
double r755946 = r755935 ? r755937 : r755945;
return r755946;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.7 |
|---|---|
| Target | 17.4 |
| Herbie | 17.5 |
if x < -8.278564204971222e+77Initial program 48.5
Taylor expanded around -inf 11.8
if -8.278564204971222e+77 < x < 1.9891121466079622e+116Initial program 21.2
if 1.9891121466079622e+116 < x Initial program 54.7
Taylor expanded around inf 8.7
Final simplification17.5
herbie shell --seed 2020081
(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))))