\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -3.8460535119133569 \cdot 10^{74}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le -1.3504253849915568 \cdot 10^{-194}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{elif}\;x \le -2.968956980813959 \cdot 10^{-266}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \le 1.19099635470288769 \cdot 10^{-228}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{elif}\;x \le 1.08574889376971239 \cdot 10^{-190}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \le 3.98422560465703889 \cdot 10^{39}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double code(double x, double y) {
return sqrt(((x * x) + (y * y)));
}
double code(double x, double y) {
double temp;
if ((x <= -3.846053511913357e+74)) {
temp = (-1.0 * x);
} else {
double temp_1;
if ((x <= -1.3504253849915568e-194)) {
temp_1 = sqrt(((x * x) + (y * y)));
} else {
double temp_2;
if ((x <= -2.968956980813959e-266)) {
temp_2 = y;
} else {
double temp_3;
if ((x <= 1.1909963547028877e-228)) {
temp_3 = sqrt(((x * x) + (y * y)));
} else {
double temp_4;
if ((x <= 1.0857488937697124e-190)) {
temp_4 = y;
} else {
double temp_5;
if ((x <= 3.984225604657039e+39)) {
temp_5 = sqrt(((x * x) + (y * y)));
} else {
temp_5 = x;
}
temp_4 = temp_5;
}
temp_3 = temp_4;
}
temp_2 = temp_3;
}
temp_1 = temp_2;
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.6 |
|---|---|
| Target | 17.8 |
| Herbie | 18.7 |
if x < -3.846053511913357e+74Initial program 47.2
Taylor expanded around -inf 10.7
if -3.846053511913357e+74 < x < -1.3504253849915568e-194 or -2.968956980813959e-266 < x < 1.1909963547028877e-228 or 1.0857488937697124e-190 < x < 3.984225604657039e+39Initial program 20.9
if -1.3504253849915568e-194 < x < -2.968956980813959e-266 or 1.1909963547028877e-228 < x < 1.0857488937697124e-190Initial program 31.4
Taylor expanded around 0 34.8
if 3.984225604657039e+39 < x Initial program 43.8
Taylor expanded around inf 13.6
Final simplification18.7
herbie shell --seed 2020057
(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))))