\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \leq -2.7569446232380357 \cdot 10^{+114}:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq -4.576170092116779 \cdot 10^{-56}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{elif}\;x \leq -5.047961066574088 \cdot 10^{-113}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \leq 5.63142386051803 \cdot 10^{+118}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}(FPCore (x y) :precision binary64 (sqrt (+ (* x x) (* y y))))
(FPCore (x y)
:precision binary64
(if (<= x -2.7569446232380357e+114)
(- x)
(if (<= x -4.576170092116779e-56)
(sqrt (+ (* x x) (* y y)))
(if (<= x -5.047961066574088e-113)
y
(if (<= x 5.63142386051803e+118) (sqrt (+ (* x x) (* y y))) x)))))double code(double x, double y) {
return ((double) sqrt(((double) (((double) (x * x)) + ((double) (y * y))))));
}
double code(double x, double y) {
double tmp;
if ((x <= -2.7569446232380357e+114)) {
tmp = ((double) -(x));
} else {
double tmp_1;
if ((x <= -4.576170092116779e-56)) {
tmp_1 = ((double) sqrt(((double) (((double) (x * x)) + ((double) (y * y))))));
} else {
double tmp_2;
if ((x <= -5.047961066574088e-113)) {
tmp_2 = y;
} else {
double tmp_3;
if ((x <= 5.63142386051803e+118)) {
tmp_3 = ((double) sqrt(((double) (((double) (x * x)) + ((double) (y * y))))));
} else {
tmp_3 = x;
}
tmp_2 = tmp_3;
}
tmp_1 = tmp_2;
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.6 |
|---|---|
| Target | 17.6 |
| Herbie | 18.9 |
if x < -2.75694462323803569e114Initial program 54.5
Taylor expanded around -inf 10.0
Simplified10.0
if -2.75694462323803569e114 < x < -4.57617009211677922e-56 or -5.04796106657408782e-113 < x < 5.63142386051802992e118Initial program 21.5
if -4.57617009211677922e-56 < x < -5.04796106657408782e-113Initial program 14.8
Taylor expanded around 0 42.0
if 5.63142386051802992e118 < x Initial program 55.1
Taylor expanded around inf 10.0
Final simplification18.9
herbie shell --seed 2020205
(FPCore (x y)
:name "Data.Octree.Internal:octantDistance from Octree-0.5.4.2"
:precision binary64
:herbie-target
(if (< x -1.1236950826599826e+145) (- x) (if (< x 1.116557621183362e+93) (sqrt (+ (* x x) (* y y))) x))
(sqrt (+ (* x x) (* y y))))