This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Fix ldbl-96/s_ilogbl.c



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)

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]