\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -1.287656836218587817843721098850935729447 \cdot 10^{137}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le 2.715346883449109812449415853977495365892 \cdot 10^{73}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r442862 = x;
double r442863 = r442862 * r442862;
double r442864 = y;
double r442865 = r442864 * r442864;
double r442866 = r442863 + r442865;
double r442867 = sqrt(r442866);
return r442867;
}
double f(double x, double y) {
double r442868 = x;
double r442869 = -1.2876568362185878e+137;
bool r442870 = r442868 <= r442869;
double r442871 = -1.0;
double r442872 = r442871 * r442868;
double r442873 = 2.7153468834491098e+73;
bool r442874 = r442868 <= r442873;
double r442875 = r442868 * r442868;
double r442876 = y;
double r442877 = r442876 * r442876;
double r442878 = r442875 + r442877;
double r442879 = sqrt(r442878);
double r442880 = r442874 ? r442879 : r442868;
double r442881 = r442870 ? r442872 : r442880;
return r442881;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.9 |
|---|---|
| Target | 17.6 |
| Herbie | 17.7 |
if x < -1.2876568362185878e+137Initial program 59.8
Taylor expanded around -inf 9.3
if -1.2876568362185878e+137 < x < 2.7153468834491098e+73Initial program 21.5
if 2.7153468834491098e+73 < x Initial program 47.0
Taylor expanded around inf 10.5
Final simplification17.7
herbie shell --seed 2019304
(FPCore (x y)
:name "Data.Octree.Internal:octantDistance from Octree-0.5.4.2"
:precision binary64
:herbie-target
(if (< x -1.123695082659983e145) (- x) (if (< x 1.11655762118336204e93) (sqrt (+ (* x x) (* y y))) x))
(sqrt (+ (* x x) (* y y))))