\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -4.00847790071649149 \cdot 10^{147}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le 4.7344679219365152 \cdot 10^{65}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r783044 = x;
double r783045 = r783044 * r783044;
double r783046 = y;
double r783047 = r783046 * r783046;
double r783048 = r783045 + r783047;
double r783049 = sqrt(r783048);
return r783049;
}
double f(double x, double y) {
double r783050 = x;
double r783051 = -4.0084779007164915e+147;
bool r783052 = r783050 <= r783051;
double r783053 = -1.0;
double r783054 = r783053 * r783050;
double r783055 = 4.734467921936515e+65;
bool r783056 = r783050 <= r783055;
double r783057 = r783050 * r783050;
double r783058 = y;
double r783059 = r783058 * r783058;
double r783060 = r783057 + r783059;
double r783061 = sqrt(r783060);
double r783062 = r783056 ? r783061 : r783050;
double r783063 = r783052 ? r783054 : r783062;
return r783063;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.9 |
|---|---|
| Target | 18.0 |
| Herbie | 18.0 |
if x < -4.0084779007164915e+147Initial program 62.0
Taylor expanded around -inf 8.5
if -4.0084779007164915e+147 < x < 4.734467921936515e+65Initial program 21.7
if 4.734467921936515e+65 < x Initial program 47.4
Taylor expanded around inf 11.9
Final simplification18.0
herbie shell --seed 2020034
(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))))