\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \leq -4.3382686603473446 \cdot 10^{+135}:\\
\;\;\;\;-x\\
\mathbf{elif}\;x \leq -2.3620464573579147 \cdot 10^{-209}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{elif}\;x \leq 9.758403782058524 \cdot 10^{-175}:\\
\;\;\;\;y\\
\mathbf{elif}\;x \leq 7.392709190784314 \cdot 10^{+91}:\\
\;\;\;\;\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 -4.3382686603473446e+135)
(- x)
(if (<= x -2.3620464573579147e-209)
(sqrt (+ (* x x) (* y y)))
(if (<= x 9.758403782058524e-175)
y
(if (<= x 7.392709190784314e+91) (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 <= -4.3382686603473446e+135)) {
tmp = ((double) -(x));
} else {
double tmp_1;
if ((x <= -2.3620464573579147e-209)) {
tmp_1 = ((double) sqrt(((double) (((double) (x * x)) + ((double) (y * y))))));
} else {
double tmp_2;
if ((x <= 9.758403782058524e-175)) {
tmp_2 = y;
} else {
double tmp_3;
if ((x <= 7.392709190784314e+91)) {
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.9 |
|---|---|
| Target | 18.2 |
| Herbie | 18.8 |
if x < -4.3382686603473446e135Initial program 58.4
Taylor expanded around -inf 9.4
Simplified9.4
if -4.3382686603473446e135 < x < -2.36204645735791475e-209 or 9.75840378205852385e-175 < x < 7.39270919078431371e91Initial program 18.2
if -2.36204645735791475e-209 < x < 9.75840378205852385e-175Initial program 30.6
Taylor expanded around 0 33.6
if 7.39270919078431371e91 < x Initial program 50.8
Taylor expanded around inf 11.8
Final simplification18.8
herbie shell --seed 2020210
(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))))