Fix ldbl-96/s_ilogbl.c

Andreas Jaeger aj@suse.de
Wed Aug 8 06:57:00 GMT 2001


Running the math tests I noticed that ilogbl (+-Inf) had the wrong
return value on x86-64.

The following patch fixes the bug.

Ok to commit?

Andreas

2001-08-08  Andreas Jaeger  <aj@suse.de>

	* sysdeps/ieee754/ldbl-96/s_ilogbl.c (__ilogbl): Fix test for
	  infinity.

============================================================
Index: sysdeps/ieee754/ldbl-96/s_ilogbl.c
--- sysdeps/ieee754/ldbl-96/s_ilogbl.c	2001/06/06 12:49:39	1.2
+++ sysdeps/ieee754/ldbl-96/s_ilogbl.c	2001/08/08 13:54:00
@@ -53,9 +53,13 @@ static char rcsid[] = "$NetBSD: $";
 	    return ix;
 	}
 	else if (es<0x7fff) return es-0x3fff;
-	else if (FP_ILOGBNAN != INT_MAX && (hx|lx) == 0)
-	    /* ISO C99 requires ilogbl(+-Inf) == INT_MAX.  */
-	    return INT_MAX;
+	else if (FP_ILOGBNAN != INT_MAX)
+	{
+	    GET_LDOUBLE_WORDS(es,hx,lx,x);
+	    if ((hx & 0x7fffffff|lx) == 0)
+	      /* ISO C99 requires ilogbl(+-Inf) == INT_MAX.  */
+	      return INT_MAX;
+	}
 	return FP_ILOGBNAN;
 }
 weak_alias (__ilogbl, ilogbl)

-- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7cUUyOJpWPMJyoSYRAvq6AKCXtkw2hdeTcUa/e5Au/eLVM694+QCfSK+o
E3Ae1rX7xkKbOIaHr86AT9M=
=IwrM
-----END PGP SIGNATURE-----From drepper@redhat.com Wed Aug 08 08:58:00 2001
From: Ulrich Drepper <drepper@redhat.com>
To: Andreas Jaeger <aj@suse.de>
Cc: GNU libc hacker <libc-hacker@sourceware.cygnus.com>
Subject: Re: Fix ldbl-96/s_ilogbl.c
Date: Wed, 08 Aug 2001 08:58:00 -0000
Message-id: <m3heviwntv.fsf@otr.mynet>
References: <hor8um4pu7.fsf@gee.suse.de>
X-SW-Source: 2001-08/msg00029.html
Content-length: 281

Andreas Jaeger <aj@suse.de> writes:

> Ok to commit?

Yes.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------



More information about the Libc-hacker mailing list