summary refs log tree commit diff
path: root/sysdeps/libm-ieee754
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/libm-ieee754')
-rw-r--r--sysdeps/libm-ieee754/s_isinf.c8
-rw-r--r--sysdeps/libm-ieee754/s_isinff.c8
-rw-r--r--sysdeps/libm-ieee754/s_isinfl.c8
-rw-r--r--sysdeps/libm-ieee754/s_lround.c24
4 files changed, 18 insertions, 30 deletions
diff --git a/sysdeps/libm-ieee754/s_isinf.c b/sysdeps/libm-ieee754/s_isinf.c
index 6f76ce1fba..4f063d09c5 100644
--- a/sysdeps/libm-ieee754/s_isinf.c
+++ b/sysdeps/libm-ieee754/s_isinf.c
@@ -16,12 +16,8 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $";
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
-	int __isinf(double x)
-#else
-	int __isinf(x)
-	double x;
-#endif
+int
+__isinf (double x)
 {
 	int32_t hx,lx;
 	EXTRACT_WORDS(hx,lx,x);
diff --git a/sysdeps/libm-ieee754/s_isinff.c b/sysdeps/libm-ieee754/s_isinff.c
index 18a0b5e03b..efc0935251 100644
--- a/sysdeps/libm-ieee754/s_isinff.c
+++ b/sysdeps/libm-ieee754/s_isinff.c
@@ -15,12 +15,8 @@ static char rcsid[] = "$NetBSD: s_isinff.c,v 1.3 1995/05/11 23:20:21 jtc Exp $";
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
-	int __isinff(float x)
-#else
-	int __isinff(x)
-	float x;
-#endif
+int
+__isinff (float x)
 {
 	int32_t ix,t;
 	GET_FLOAT_WORD(ix,x);
diff --git a/sysdeps/libm-ieee754/s_isinfl.c b/sysdeps/libm-ieee754/s_isinfl.c
index b499821441..697534ed0d 100644
--- a/sysdeps/libm-ieee754/s_isinfl.c
+++ b/sysdeps/libm-ieee754/s_isinfl.c
@@ -16,12 +16,8 @@ static char rcsid[] = "$NetBSD: $";
 #include "math.h"
 #include "math_private.h"
 
-#ifdef __STDC__
-	int __isinfl(long double x)
-#else
-	int __isinfl(x)
-	long double x;
-#endif
+int
+__isinfl (long double x)
 {
 	int32_t se,hx,lx;
 	GET_LDOUBLE_WORDS(se,hx,lx,x);
diff --git a/sysdeps/libm-ieee754/s_lround.c b/sysdeps/libm-ieee754/s_lround.c
index 0f91280a79..974dbde050 100644
--- a/sysdeps/libm-ieee754/s_lround.c
+++ b/sysdeps/libm-ieee754/s_lround.c
@@ -26,40 +26,40 @@
 #ifdef NO_LONG_DOUBLE
 /* The `long double' is in fact the IEEE `double' type.  */
 
+/* This code does not presently work.  */
+
 long int
 __lround (long double x)
 {
   int32_t j0;
   u_int32_t i1, i0;
   long int result;
+  int sign;
 
   EXTRACT_WORDS (i0, i1, x);
   j0 = ((i0 >> 20) & 0x7ff) - 0x3ff;
+  sign = (i0 & 0x80000000) != 0 ? -1 : 1;
+  i0 &= 0xfffff;
   if (j0 < 20)
     {
       if (j0 < 0)
-	result = j0 < -1 ? 0 : ((i0 & 0x80000000) ? -1 : 1);
+	result = j0 < -1 ? 0 : sign;
       else
 	{
 	  u_int32_t i = 0xfffff >> j0;
+	  i0 |= 0x100000;
 	  if (((i0 & i) | i1) == 0)
-	    result = (long int) ((i0 & 0xfffff) | 0x100000) >> j0;
+	    result = i0 >> j0;
 	  else
-	    {
-	      /* X is not integral.  */
-	      u_int32_t j = i0 + (0x80000 >> j0);
-              if (j < i0)
-		result = (long int) 0x80000 >> (20 - j0);
-	      else
-		result = (j | 0x100000) >> (20 - j0);
-	    }
+	    /* X is not integral.  */
+	    result = (i0 + (0x80000 >> j0)) >> (20 - j0);
 	}
     }
   else if (j0 >= 8 * sizeof (long int) || j0 > 51)
     {
       /* The number is too large.  It is left implementation defined
 	 what happens.  */
-      result = (long int) x;
+      return (long int) x;
     }
   else
     {
@@ -97,7 +97,7 @@ __lround (long double x)
 	}
     }
 
-  return i0 & 0x80000000 ? -result : result;
+  return sign * result;
 }
 #else
 long int