1 /* s_frexpl.c -- long double 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 * ====================================================
16 #if defined(LIBM_SCCS) && !defined(lint)
17 static char rcsid
[] = "$NetBSD: $";
22 * x = frexpl(arg,&exp);
23 * return a long double fp quantity x such that 0.5 <= |x| <1.0
24 * and the corresponding binary exponent "exp". That is
26 * If arg is inf, 0.0, or NaN, then frexpl(arg,&exp) returns arg
31 #include <math_private.h>
32 #include <libm-alias-ldouble.h>
34 static const _Float128
35 two114
= L(2.0769187434139310514121985316880384E+34); /* 0x4071000000000000, 0 */
37 _Float128
__frexpl(_Float128 x
, int *eptr
)
40 GET_LDOUBLE_WORDS64(hx
,lx
,x
);
41 ix
= 0x7fffffffffffffffULL
&hx
;
43 if(ix
>=0x7fff000000000000ULL
||((ix
|lx
)==0)) return x
+ x
;/* 0,inf,nan */
44 if (ix
<0x0001000000000000ULL
) { /* subnormal */
46 GET_LDOUBLE_MSW64(hx
,x
);
47 ix
= hx
&0x7fffffffffffffffULL
;
50 *eptr
+= (ix
>>48)-16382;
51 hx
= (hx
&0x8000ffffffffffffULL
) | 0x3ffe000000000000ULL
;
52 SET_LDOUBLE_MSW64(x
,hx
);
55 libm_alias_ldouble (__frexp
, frexp
)