\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -2.5872918038759956 \cdot 10^{153}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le 4.5752696805163673 \cdot 10^{135}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r704925 = x;
double r704926 = r704925 * r704925;
double r704927 = y;
double r704928 = r704927 * r704927;
double r704929 = r704926 + r704928;
double r704930 = sqrt(r704929);
return r704930;
}
double f(double x, double y) {
double r704931 = x;
double r704932 = -2.5872918038759956e+153;
bool r704933 = r704931 <= r704932;
double r704934 = -1.0;
double r704935 = r704934 * r704931;
double r704936 = 4.575269680516367e+135;
bool r704937 = r704931 <= r704936;
double r704938 = r704931 * r704931;
double r704939 = y;
double r704940 = r704939 * r704939;
double r704941 = r704938 + r704940;
double r704942 = sqrt(r704941);
double r704943 = r704937 ? r704942 : r704931;
double r704944 = r704933 ? r704935 : r704943;
return r704944;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.5 |
|---|---|
| Target | 17.4 |
| Herbie | 17.4 |
if x < -2.5872918038759956e+153Initial program 63.9
Taylor expanded around -inf 7.5
if -2.5872918038759956e+153 < x < 4.575269680516367e+135Initial program 20.7
if 4.575269680516367e+135 < x Initial program 59.0
Taylor expanded around inf 9.0
Final simplification17.4
herbie shell --seed 2020024
(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))))