1 /* frexpq.c -- __float128 version of s_frexp.c.
2 * Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
9 * Developed at SunPro, a Sun Microsystems, Inc. business.
10 * Permission to use, copy, modify, and distribute this
11 * software is freely granted, provided that this notice
13 * ====================================================
18 * x = frexpq(arg,&exp);
19 * return a __float128 fp quantity x such that 0.5 <= |x| <1.0
20 * and the corresponding binary exponent "exp". That is
22 * If arg is inf, 0.0, or NaN, then frexpq(arg,&exp) returns arg
26 #include "quadmath-imp.h"
28 static const __float128
29 two114
= 2.0769187434139310514121985316880384E+34Q
; /* 0x4071000000000000, 0 */
32 frexpq (__float128 x
, int *eptr
)
35 GET_FLT128_WORDS64(hx
,lx
,x
);
36 ix
= 0x7fffffffffffffffULL
&hx
;
38 if(ix
>=0x7fff000000000000ULL
||((ix
|lx
)==0)) return x
+ x
;/* 0,inf,nan */
39 if (ix
<0x0001000000000000ULL
) { /* subnormal */
41 GET_FLT128_MSW64(hx
,x
);
42 ix
= hx
&0x7fffffffffffffffULL
;
45 *eptr
+= (ix
>>48)-16382;
46 hx
= (hx
&0x8000ffffffffffffULL
) | 0x3ffe000000000000ULL
;
47 SET_FLT128_MSW64(x
,hx
);