\sqrt{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -2.066866671709845106834464667975644144779 \cdot 10^{108}:\\
\;\;\;\;-1 \cdot x\\
\mathbf{elif}\;x \le 4.80613782352259500769138488086471841751 \cdot 10^{109}:\\
\;\;\;\;\sqrt{x \cdot x + y \cdot y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}double f(double x, double y) {
double r827990 = x;
double r827991 = r827990 * r827990;
double r827992 = y;
double r827993 = r827992 * r827992;
double r827994 = r827991 + r827993;
double r827995 = sqrt(r827994);
return r827995;
}
double f(double x, double y) {
double r827996 = x;
double r827997 = -2.066866671709845e+108;
bool r827998 = r827996 <= r827997;
double r827999 = -1.0;
double r828000 = r827999 * r827996;
double r828001 = 4.806137823522595e+109;
bool r828002 = r827996 <= r828001;
double r828003 = r827996 * r827996;
double r828004 = y;
double r828005 = r828004 * r828004;
double r828006 = r828003 + r828005;
double r828007 = sqrt(r828006);
double r828008 = r828002 ? r828007 : r827996;
double r828009 = r827998 ? r828000 : r828008;
return r828009;
}




Bits error versus x




Bits error versus y
Results
| Original | 31.3 |
|---|---|
| Target | 17.5 |
| Herbie | 17.5 |
if x < -2.066866671709845e+108Initial program 52.1
Taylor expanded around -inf 10.0
if -2.066866671709845e+108 < x < 4.806137823522595e+109Initial program 21.0
if 4.806137823522595e+109 < x Initial program 53.6
Taylor expanded around inf 9.8
Final simplification17.5
herbie shell --seed 2019356
(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))))