about summary refs log tree commit diff
path: root/math
diff options
context:
space:
mode:
Diffstat (limited to 'math')
-rw-r--r--math/atest-exp.c8
-rw-r--r--math/atest-exp2.c8
-rw-r--r--math/atest-sincos.c14
3 files changed, 15 insertions, 15 deletions
diff --git a/math/atest-exp.c b/math/atest-exp.c
index 4cab953e46..4aef38d50e 100644
--- a/math/atest-exp.c
+++ b/math/atest-exp.c
@@ -96,11 +96,11 @@ mpn_bitsize(const mp_limb_t *SRC_PTR, mp_size_t SIZE)
    for (i = SIZE - 1; i > 0; i--)
      if (SRC_PTR[i] != 0)
        break;
-   for (j = mpbpl - 1; j > 0; j--)
-     if ((SRC_PTR[i] & 1 << j) != 0)
+   for (j = mpbpl - 1; j >= 0; j--)
+     if ((SRC_PTR[i] & (mp_limb_t)1 << j) != 0)
        break;
 
-   return i * 32 + j;
+   return i * mpbpl + j;
 }
 
 int
@@ -141,7 +141,7 @@ main (void)
 
       e2s = mpn_bitsize (e2,SZ);
       e3s = mpn_bitsize (e3,SZ);
-      if (e3s > 1 && e2s - e3s < 54)
+      if (e3s >= 0 && e2s - e3s < 54)
 	{
 #if PRINT_ERRORS
 	  printf ("%06x ", i * (0x100000 / (1 << N2)));
diff --git a/math/atest-exp2.c b/math/atest-exp2.c
index 7243944c66..059e4ccf02 100644
--- a/math/atest-exp2.c
+++ b/math/atest-exp2.c
@@ -147,11 +147,11 @@ mpn_bitsize(const mp_limb_t *SRC_PTR, mp_size_t SIZE)
   for (i = SIZE - 1; i > 0; --i)
     if (SRC_PTR[i] != 0)
       break;
-  for (j = mpbpl - 1; j > 0; --j)
-    if ((SRC_PTR[i] & 1 << j) != 0)
+  for (j = mpbpl - 1; j >= 0; --j)
+    if ((SRC_PTR[i] & (mp_limb_t)1 << j) != 0)
       break;
 
-  return i * 32 + j;
+  return i * mpbpl + j;
 }
 
 int
@@ -192,7 +192,7 @@ main (void)
 
       e2s = mpn_bitsize (e2, SZ);
       e3s = mpn_bitsize (e3, SZ);
-      if (e3s > 1 && e2s - e3s < 54)
+      if (e3s >= 0 && e2s - e3s < 54)
 	{
 #if PRINT_ERRORS
 	  printf ("%06x ", i * (0x100000 / (1 << N2)));
diff --git a/math/atest-sincos.c b/math/atest-sincos.c
index 2f4187c9c0..4dbbffb9ca 100644
--- a/math/atest-sincos.c
+++ b/math/atest-sincos.c
@@ -132,11 +132,11 @@ mpn_bitsize (const mp_limb_t *SRC_PTR, mp_size_t SIZE)
    for (i = SIZE - 1; i > 0; i--)
      if (SRC_PTR[i] != 0)
        break;
-   for (j = mpbpl - 1; j > 0; j--)
-     if ((SRC_PTR[i] & 1 << j) != 0)
+   for (j = mpbpl - 1; j >= 0; j--)
+     if ((SRC_PTR[i] & (mp_limb_t)1 << j) != 0)
        break;
 
-   return i * 32 + j;
+   return i * mpbpl + j;
 }
 
 int
@@ -188,8 +188,8 @@ main (void)
       s3s = mpn_bitsize (s3, SZ);
       c2s = mpn_bitsize (c2, SZ);
       c3s = mpn_bitsize (c3, SZ);
-      if (s3s > 1 && s2s - s3s < 54
-	  || c3s > 1 && c2s - c3s < 54
+      if (s3s >= 0 && s2s - s3s < 54
+	  || c3s >= 0 && c2s - c3s < 54
 	  || 0)
 	{
 #if PRINT_ERRORS
@@ -204,8 +204,8 @@ main (void)
 	  print_mpn_hex (c2, (FRAC / 4) + 1);
 	  putchar ('\n');
 	  printf (" %c%c    ",
-		  s2s-s3s < 54 ? s2s - s3s == 53 ? 'e' : 'F' : 'P',
-		  c2s-c3s < 54 ? c2s - c3s == 53 ? 'e' : 'F' : 'P');
+		  s3s >= 0 && s2s-s3s < 54 ? s2s - s3s == 53 ? 'e' : 'F' : 'P',
+		  c3s >= 0 && c2s-c3s < 54 ? c2s - c3s == 53 ? 'e' : 'F' : 'P');
 	  print_mpn_hex (s3, (FRAC / 4) + 1);
 	  putchar (' ');
 	  print_mpn_hex (c3, (FRAC / 4) + 1);