summaryrefslogtreecommitdiff
path: root/sysdeps/libm-ieee754/s_isinf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754/s_isinf.c')
-rw-r--r--sysdeps/libm-ieee754/s_isinf.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sysdeps/libm-ieee754/s_isinf.c b/sysdeps/libm-ieee754/s_isinf.c
index b35fc1c41c..d3c2cb55b7 100644
--- a/sysdeps/libm-ieee754/s_isinf.c
+++ b/sysdeps/libm-ieee754/s_isinf.c
@@ -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