\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -2.5847343597756595 \cdot 10^{+152}:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \le -2.35268515513709 \cdot 10^{-257}:\\
\;\;\;\;\sqrt{y \cdot y + x \cdot x}\\
\mathbf{elif}\;x \le 1.6972939667011593 \cdot 10^{-158}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \le 3.161818111636812 \cdot 10^{+106}:\\
\;\;\;\;\sqrt{y \cdot y + x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r36781160 = x;
double r36781161 = r36781160 * r36781160;
double r36781162 = y;
double r36781163 = r36781162 * r36781162;
double r36781164 = r36781161 + r36781163;
double r36781165 = sqrt(r36781164);
return r36781165;
}
double f(double x, double y) {
double r36781166 = x;
double r36781167 = -2.5847343597756595e+152;
bool r36781168 = r36781166 <= r36781167;
double r36781169 = -r36781166;
double r36781170 = -2.35268515513709e-257;
bool r36781171 = r36781166 <= r36781170;
double r36781172 = y;
double r36781173 = r36781172 * r36781172;
double r36781174 = r36781166 * r36781166;
double r36781175 = r36781173 + r36781174;
double r36781176 = sqrt(r36781175);
double r36781177 = 1.6972939667011593e-158;
bool r36781178 = r36781166 <= r36781177;
double r36781179 = 3.161818111636812e+106;
bool r36781180 = r36781166 <= r36781179;
double r36781181 = r36781180 ? r36781176 : r36781166;
double r36781182 = r36781178 ? r36781172 : r36781181;
double r36781183 = r36781171 ? r36781176 : r36781182;
double r36781184 = r36781168 ? r36781169 : r36781183;
return r36781184;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.4 |
|---|---|
| Target | 17.7 |
| Herbie | 18.5 |
if x < -2.5847343597756595e+152Initial program 63.4
Taylor expanded around -inf 8.7
Simplified8.7
if -2.5847343597756595e+152 < x < -2.35268515513709e-257 or 1.6972939667011593e-158 < x < 3.161818111636812e+106Initial program 18.0
if -2.35268515513709e-257 < x < 1.6972939667011593e-158Initial program 30.0
Taylor expanded around 0 35.1
if 3.161818111636812e+106 < x Initial program 52.7
Taylor expanded around inf 10.6
Final simplification18.5
herbie shell --seed 2019165
(FPCore (x y)
:name "Data.Octree.Internal:octantDistance from Octree-0.5.4.2"
:herbie-target
(if (< x -1.1236950826599826e+145) (- x) (if (< x 1.116557621183362e+93) (sqrt (+ (* x x) (* y y))) x))
(sqrt (+ (* x x) (* y y))))