mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-23 05:20:06 +00:00
207390f763
2001-06-11 Michael Deutschmann <michael@talamasca.ocis.net> * rt/tst-aio4.c (do_test): Test whether rt signals are supported. Use my_signo instead of MY_SIGNO and initialize it so that the used signal is always available. 2001-06-11 Andreas Jaeger <aj@suse.de>, Michael Deutschmann <michael@talamasca.ocis.net> * io/test-lfs.c (do_prepare): Clean up error messages. (test_ftello): Check for EFBIG and ENOSP, clean up error messages. (do_test): Likewise. 2001-06-11 Andreas Jaeger <aj@suse.de> * sysdeps/unix/sysv/linux/powerpc/bits/termios.h (IXANY, IUCLC, IMAXBEL): Make always visible since they're needed by POSIX. Closes PR libc/2320, reported by Chris Yeoh <cyeoh@samba.org>. 2001-06-10 Ben Collins <bcollins@debian.org> * sysdeps/arm/elf/start.S: Use #function, not @function, for .type of _start. * sysdeps/ieee754/ldbl-128/s_ilogbl.c: Include limits.h to get INT_MAX. 2001-06-07 H.J. Lu <hjl@gnu.org> * sunrpc/rpc/rpc.h: Add __BEGIN_DECLS/__END_DECLS.
63 lines
1.6 KiB
C
63 lines
1.6 KiB
C
/* s_ilogbl.c -- long double version of s_ilogb.c.
|
|
* Conversion to IEEE quad long double by Jakub Jelinek, jj@ultra.linux.cz.
|
|
*/
|
|
|
|
/*
|
|
* ====================================================
|
|
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
*
|
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
* Permission to use, copy, modify, and distribute this
|
|
* software is freely granted, provided that this notice
|
|
* is preserved.
|
|
* ====================================================
|
|
*/
|
|
|
|
#if defined(LIBM_SCCS) && !defined(lint)
|
|
static char rcsid[] = "$NetBSD: $";
|
|
#endif
|
|
|
|
/* ilogbl(long double x)
|
|
* return the binary exponent of non-zero x
|
|
* ilogbl(0) = FP_ILOGB0
|
|
* ilogbl(NaN) = FP_ILOGBNAN (no signal is raised)
|
|
* ilogbl(+-Inf) = INT_MAX (no signal is raised)
|
|
*/
|
|
|
|
#include <limits.h>
|
|
#include "math.h"
|
|
#include "math_private.h"
|
|
|
|
#ifdef __STDC__
|
|
int __ilogbl(long double x)
|
|
#else
|
|
int __ilogbl(x)
|
|
long double x;
|
|
#endif
|
|
{
|
|
int64_t hx,lx;
|
|
int ix;
|
|
|
|
GET_LDOUBLE_WORDS64(hx,lx,x);
|
|
hx &= 0x7fffffffffffffffLL;
|
|
if(hx <= 0x0001000000000000LL) {
|
|
if((hx|lx)==0)
|
|
return FP_ILOGB0; /* ilogbl(0) = FP_ILOGB0 */
|
|
else /* subnormal x */
|
|
if(hx==0) {
|
|
for (ix = -16431; lx>0; lx<<=1) ix -=1;
|
|
} else {
|
|
for (ix = -16382, hx<<=15; hx>0; hx<<=1) ix -=1;
|
|
}
|
|
return ix;
|
|
}
|
|
else if (hx<0x7fff000000000000LL) return (hx>>48)-0x3fff;
|
|
else if (FP_ILOGBNAN != INT_MAX) {
|
|
/* ISO C99 requires ilogbl(+-Inf) == INT_MAX. */
|
|
if (((hx^0x7fff000000000000LL)|lx) == 0)
|
|
return INT_MAX;
|
|
}
|
|
return FP_ILOGBNAN;
|
|
}
|
|
weak_alias (__ilogbl, ilogbl)
|