1 /* s_frexpl.c -- long double version of s_frexp.c.
5 * ====================================================
6 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8 * Developed at SunPro, a Sun Microsystems, Inc. business.
9 * Permission to use, copy, modify, and distribute this
10 * software is freely granted, provided that this notice
12 * ====================================================
15 #if defined(LIBM_SCCS) && !defined(lint)
16 static char rcsid
[] = "$NetBSD: $";
21 * x = frexpl(arg,&exp);
22 * return a long double fp quantity x such that 0.5 <= |x| <1.0
23 * and the corresponding binary exponent "exp". That is
25 * 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 long double
35 #if LDBL_MANT_DIG == 64
36 two65
= 3.68934881474191032320e+19L; /* 0x4040, 0x80000000, 0x00000000 */
38 # error "Cannot handle this MANT_DIG"
42 long double __frexpl(long double x
, int *eptr
)
44 uint32_t se
, hx
, ix
, lx
;
45 GET_LDOUBLE_WORDS(se
,hx
,lx
,x
);
48 if(ix
==0x7fff||((ix
|hx
|lx
)==0)) return x
+ x
; /* 0,inf,nan */
49 if (ix
==0x0000) { /* subnormal */
51 GET_LDOUBLE_EXP(se
,x
);
56 se
= (se
& 0x8000) | 0x3ffe;
57 SET_LDOUBLE_EXP(x
,se
);
60 libm_alias_ldouble (__frexp
, frexp
)