]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Rewrite to return -1 for -inf.
authorUlrich Drepper <drepper@redhat.com>
Mon, 17 Mar 1997 04:08:05 +0000 (04:08 +0000)
committerUlrich Drepper <drepper@redhat.com>
Mon, 17 Mar 1997 04:08:05 +0000 (04:08 +0000)
sysdeps/libm-ieee754/s_isinf.c
sysdeps/libm-ieee754/s_isinff.c
sysdeps/libm-ieee754/s_isinfl.c

index b35fc1c41c5321362ff66aa07e60d0973e575b9c..d3c2cb55b724326739138b9407f4ab2caccf3eb3 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Written by J.T. Conklin <jtc@netbsd.org>.
+ * Changed to return -1 for -Inf by Ulrich Drepper <drepper@cygnus.com>.
  * Public domain.
  */
 
@@ -8,7 +9,7 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $";
 #endif
 
 /*
- * isinf(x) returns 1 is x is inf, else 0;
+ * isinf(x) returns 1 is x is inf, -1 if x is -inf, else 0;
  * no branching!
  */
 
@@ -22,12 +23,12 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $";
        double x;
 #endif
 {
-       int32_t hx,lx;
+       u_int32_t hx;
+       int32_t lx;
        EXTRACT_WORDS(hx,lx,x);
-       hx &= 0x7fffffff;
-       hx ^= 0x7ff00000;
-       hx |= lx;
-       return (hx == 0);
+       lx |= (hx & 0x7fffffff) ^ 0x7ff00000;
+       lx |= -lx;
+       return ~(lx >> 31) & (1 - ((hx >> 30) & 2));
 }
 weak_alias (__isinf, isinf)
 #ifdef NO_LONG_DOUBLE
index 1d81f15986155db585e41f5d22a0ac955784f039..9acc0df6ec94b28fcb20c21002e50663101f0168 100644 (file)
@@ -8,7 +8,7 @@ static char rcsid[] = "$NetBSD: s_isinff.c,v 1.3 1995/05/11 23:20:21 jtc Exp $";
 #endif
 
 /*
- * isinff(x) returns 1 is x is inf, else 0;
+ * isinff(x) returns 1 if x is inf, -1 if x is -inf, else 0;
  * no branching!
  */
 
@@ -22,10 +22,11 @@ static char rcsid[] = "$NetBSD: s_isinff.c,v 1.3 1995/05/11 23:20:21 jtc Exp $";
        float x;
 #endif
 {
-       int32_t ix;
+       int32_t ix,t;
        GET_FLOAT_WORD(ix,x);
-       ix &= 0x7fffffff;
-       ix ^= 0x7f800000;
-       return (ix == 0);
+       t = ix & 0x7fffffff;
+       t ^= 0x7f800000;
+       t |= -t;
+       return ~(t >> 31) & (1 - ((ix & 0x80000000) >> 30));
 }
 weak_alias (__isinff, isinff)
index 22dff75444d453b4cd633cc087107b94f82df9d2..b499821441939b9d59ad3d944398d353430832c6 100644 (file)
@@ -9,7 +9,7 @@ static char rcsid[] = "$NetBSD: $";
 #endif
 
 /*
- * isinfl(x) returns 1 is x is inf, else 0;
+ * isinfl(x) returns 1 if x is inf, -1 if x is -inf, else 0;
  * no branching!
  */
 
@@ -25,9 +25,9 @@ static char rcsid[] = "$NetBSD: $";
 {
        int32_t se,hx,lx;
        GET_LDOUBLE_WORDS(se,hx,lx,x);
-       se &= 0x7fff;
-       se ^= 0x7fff;
-       se |= hx | lx;
-       return (se == 0);
+       hx |= lx | ((se & 0x7fff) ^ 0x7fff);
+       hx |= -hx;
+       se &= 0x8000;
+       return ~(hx >> 31) & (1 - (se >> 14));
 }
 weak_alias (__isinfl, isinfl)