about 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_llrintl.c23
-rw-r--r--sysdeps/libm-ieee754/s_lrintl.c4
-rw-r--r--sysdeps/libm-ieee754/s_nextafterxf.c2
3 files changed, 10 insertions, 19 deletions
diff --git a/sysdeps/libm-ieee754/s_llrintl.c b/sysdeps/libm-ieee754/s_llrintl.c
index 29fc3a300d..d3b9b12d76 100644
--- a/sysdeps/libm-ieee754/s_llrintl.c
+++ b/sysdeps/libm-ieee754/s_llrintl.c
@@ -34,7 +34,7 @@ long long int
 __llrintl (long double x)
 {
   int32_t se,j0;
-  u_int32_t i0, i1, i;
+  u_int32_t i0, i1;
   long long int result;
   volatile long double w;
   long double t;
@@ -45,23 +45,11 @@ __llrintl (long double x)
   sx = (se >> 15) & 1;
   j0 = (se & 0x7fff) - 0x3fff;
 
-  if (j0 < 31)
+  if (j0 < (int32_t) (8 * sizeof (long long int)))
     {
       if (j0 < -1)
 	return 0;
-      else
-	{
-	  w = two63[sx] + x;
-	  t = w - two63[sx];
-	  GET_LDOUBLE_WORDS (se, i0, i1, t);
-	  j0 = (se & 0x7fff) - 0x3fff;
-
-	  result = i0 >> (31 - j0);
-	}
-    }
-  else if (j0 < (int32_t) (8 * sizeof (long long int)))
-    {
-      if (j0 >= 63)
+      else if (j0 >= 63)
 	result = ((long long int) i0 << (j0 - 31)) | (i1 << (j0 - 63));
       else
 	{
@@ -70,7 +58,10 @@ __llrintl (long double x)
 	  GET_LDOUBLE_WORDS (se, i0, i1, t);
 	  j0 = (se & 0x7fff) - 0x3fff;
 
-	  result = ((long long int) i0 << (j0 - 31)) | (j >> (63 - j0));
+	  if (j0 < 31)
+	    result = i0 >> (31 - j0);
+	  else
+	    result = ((long long int) i0 << (j0 - 31)) | (i1 >> (63 - j0));
 	}
     }
   else
diff --git a/sysdeps/libm-ieee754/s_lrintl.c b/sysdeps/libm-ieee754/s_lrintl.c
index 8607851669..5a41427f72 100644
--- a/sysdeps/libm-ieee754/s_lrintl.c
+++ b/sysdeps/libm-ieee754/s_lrintl.c
@@ -34,7 +34,7 @@ long int
 __lrintl (long double x)
 {
   int32_t se,j0;
-  u_int32_t i0,i1,i;
+  u_int32_t i0, i1;
   long int result;
   volatile long double w;
   long double t;
@@ -70,7 +70,7 @@ __lrintl (long double x)
 	  GET_LDOUBLE_WORDS (se, i0, i1, t);
 	  j0 = (se & 0x7fff) - 0x3fff;
 
-	  result = ((long int) i0 << (j0 - 31)) | (j >> (63 - j0));
+	  result = ((long int) i0 << (j0 - 31)) | (i1 >> (63 - j0));
 	}
     }
   else
diff --git a/sysdeps/libm-ieee754/s_nextafterxf.c b/sysdeps/libm-ieee754/s_nextafterxf.c
index 7e870805e2..a4726b41b8 100644
--- a/sysdeps/libm-ieee754/s_nextafterxf.c
+++ b/sysdeps/libm-ieee754/s_nextafterxf.c
@@ -25,7 +25,7 @@ static char rcsid[] = "$NetBSD: $";
 #else
 	float __nextafterxf(x,y)
 	float x;
-	log double y;
+	long double y;
 #endif
 {
 	int32_t hx,ix,iy;