\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -3.6980740601030615 \cdot 10^{63}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le 9.1753737888878369 \cdot 10^{116}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r781981 = x;
double r781982 = r781981 * r781981;
double r781983 = y;
double r781984 = r781983 * r781983;
double r781985 = r781982 + r781984;
double r781986 = sqrt(r781985);
return r781986;
}
double f(double x, double y) {
double r781987 = x;
double r781988 = -3.6980740601030615e+63;
bool r781989 = r781987 <= r781988;
double r781990 = -1.0;
double r781991 = r781990 * r781987;
double r781992 = 9.175373788887837e+116;
bool r781993 = r781987 <= r781992;
double r781994 = r781987 * r781987;
double r781995 = y;
double r781996 = r781995 * r781995;
double r781997 = r781994 + r781996;
double r781998 = sqrt(r781997);
double r781999 = r781993 ? r781998 : r781987;
double r782000 = r781989 ? r781991 : r781999;
return r782000;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.1 |
|---|---|
| Target | 17.3 |
| Herbie | 17.3 |
if x < -3.6980740601030615e+63Initial program 46.0
Taylor expanded around -inf 11.0
if -3.6980740601030615e+63 < x < 9.175373788887837e+116Initial program 20.9
if 9.175373788887837e+116 < x Initial program 55.4
Taylor expanded around inf 10.0
Final simplification17.3
herbie shell --seed 2020064
(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))))