5 #if FLT_EVAL_METHOD > 1U && LDBL_MANT_DIG == 64
6 #define SPLIT (0x1p32 + 1)
8 #define SPLIT (0x1p27 + 1)
11 static void sq(double_t
*hi
, double_t
*lo
, double x
)
15 xc
= (double_t
)x
*SPLIT
;
19 *lo
= xh
*xh
- *hi
+ 2*xh
*xl
+ xl
*xl
;
22 double hypot(double x
, double y
)
24 union {double f
; uint64_t i
;} ux
= {x
}, uy
= {y
}, ut
;
26 double_t hx
, lx
, hy
, ly
, z
;
28 /* arrange |x| >= |y| */
42 /* note: hypot(inf,nan) == inf */
45 if (ex
== 0x7ff || uy
.i
== 0)
47 /* note: hypot(x,y) ~= x + y*y/x/2 with inexact for small y/x */
48 /* 64 difference is enough for ld80 double_t */
52 /* precise sqrt argument in nearest rounding mode without overflow */
53 /* xh*xh must not overflow and xl*xl must not underflow in sq */
59 } else if (ey
< 0x3ff-450) {
66 return z
*sqrt(ly
+lx
+hy
+hx
);