* numbers.c (scm_string_to_number): Signal an error if radix is
[bpt/guile.git] / libguile / numbers.c
index 730b7d6..7695628 100644 (file)
@@ -220,13 +220,11 @@ scm_quotient (x, y)
     }
   if (SCM_NINUMP (y))
     {
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_BIGP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_quotient, x, y, SCM_ARG2, s_quotient);
        }
-#endif
       return SCM_INUM0;
     }
 #else
@@ -290,13 +288,11 @@ scm_remainder (x, y)
     }
   if (SCM_NINUMP (y))
     {
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_BIGP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_remainder, x, y, SCM_ARG2, s_remainder);
        }
-#endif
       return x;
     }
 #else
@@ -353,13 +349,11 @@ scm_modulo (x, y)
     }
   if (SCM_NINUMP (y))
     {
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_BIGP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_modulo, x, y, SCM_ARG2, s_modulo);
        }
-#endif
       return (SCM_BIGSIGN (y) ? (x > 0) : (x < 0)) ? scm_sum (x, y) : x;
     }
 #else
@@ -1826,7 +1820,11 @@ scm_number_to_string (x, radix)
   if (SCM_UNBNDP (radix))
     radix = SCM_MAKINUM (10L);
   else
-    SCM_ASSERT (SCM_INUMP (radix), radix, SCM_ARG2, s_number_to_string);
+    {
+      SCM_ASSERT (SCM_INUMP (radix), radix, SCM_ARG2, s_number_to_string);
+      SCM_ASSERT (SCM_INUM (radix) >= 2, radix, SCM_OUTOFRANGE,
+                 s_number_to_string);
+    }
 #ifdef SCM_FLOATS
   if (SCM_NINUMP (x))
     {
@@ -2452,7 +2450,11 @@ scm_string_to_number (str, radix)
   if (SCM_UNBNDP (radix))
     radix = SCM_MAKINUM (10L);
   else
-    SCM_ASSERT (SCM_INUMP (radix), radix, SCM_ARG2, s_string_to_number);
+    {
+      SCM_ASSERT (SCM_INUMP (radix), radix, SCM_ARG2, s_string_to_number);
+      SCM_ASSERT (SCM_INUM (radix) >= 2, radix, SCM_OUTOFRANGE,
+                 s_number_to_string);
+    }
   SCM_ASSERT (SCM_NIMP (str) && SCM_ROSTRINGP (str),
              str, SCM_ARG1, s_string_to_number);
   answer = scm_istring2number (SCM_ROCHARS (str),
@@ -2636,13 +2638,11 @@ scm_num_eq_p (x, y)
   if (SCM_NINUMP (x))
     {
 #ifdef SCM_BIGDIG
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (x)))
        {
        badx:
          SCM_WTA_DISPATCH_2 (g_eq_p, x, y, SCM_ARG1, s_eq_p);
        }
-#endif
       if (SCM_BIGP (x))
        {
          if (SCM_INUMP (y))
@@ -2695,21 +2695,17 @@ scm_num_eq_p (x, y)
       SCM_ASRTGO (SCM_NIMP (y), bady);
       if (SCM_BIGP (y))
        return SCM_BOOL_F;
-#ifndef SCM_RECKLESS
       if (!(SCM_INEXP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_eq_p, x, y, SCM_ARGn, s_eq_p);
        }
-#endif
 #else
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_INEXP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_eq_p, x, y, SCM_ARGn, s_eq_p);
        }
-#endif
 #endif
     realint:
       return ((SCM_REALP (y) && (((double) SCM_INUM (x)) == SCM_REALPART (y)))
@@ -2729,13 +2725,11 @@ scm_num_eq_p (x, y)
     }
   if (SCM_NINUMP (y))
     {
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_BIGP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_eq_p, x, y, SCM_ARGn, s_eq_p);
        }
-#endif
       return SCM_BOOL_F;
     }
 #else
@@ -2759,13 +2753,11 @@ scm_less_p (x, y)
   if (SCM_NINUMP (x))
     {
 #ifdef SCM_BIGDIG
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (x)))
        {
        badx:
          SCM_WTA_DISPATCH_2 (g_less_p, x, y, SCM_ARG1, s_less_p);
        }
-#endif
       if (SCM_BIGP (x))
        {
          if (SCM_INUMP (y))
@@ -2803,21 +2795,17 @@ scm_less_p (x, y)
       SCM_ASRTGO (SCM_NIMP (y), bady);
       if (SCM_BIGP (y))
        return SCM_BIGSIGN (y) ? SCM_BOOL_F : SCM_BOOL_T;
-#ifndef SCM_RECKLESS
       if (!(SCM_REALP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_less_p, x, y, SCM_ARGn, s_less_p);
        }
-#endif
 #else
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_REALP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_less_p, x, y, SCM_ARGn, s_less_p);
        }
-#endif
 #endif
       return ((((double) SCM_INUM (x)) < SCM_REALPART (y))
              ? SCM_BOOL_T
@@ -2836,13 +2824,11 @@ scm_less_p (x, y)
     }
   if (SCM_NINUMP (y))
     {
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_BIGP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_less_p, x, y, SCM_ARGn, s_less_p);
        }
-#endif
       return SCM_BIGSIGN (y) ? SCM_BOOL_F : SCM_BOOL_T;
     }
 #else
@@ -2903,13 +2889,11 @@ scm_zero_p (z)
       SCM_ASRTGO (SCM_NIMP (z), badz);
       if (SCM_BIGP (z))
        return SCM_BOOL_F;
-#ifndef SCM_RECKLESS
       if (!(SCM_INEXP (z)))
        {
        badz:
          SCM_WTA_DISPATCH_1 (g_zero_p, z, SCM_ARG1, s_zero_p);
        }
-#endif
 #else
       SCM_GASSERT1 (SCM_NIMP (z) && SCM_INEXP (z),
                    g_zero_p, z, SCM_ARG1, s_zero_p);
@@ -2946,13 +2930,11 @@ scm_positive_p (x)
       SCM_ASRTGO (SCM_NIMP (x), badx);
       if (SCM_BIGP (x))
        return SCM_TYP16 (x) == scm_tc16_bigpos ? SCM_BOOL_T : SCM_BOOL_F;
-#ifndef SCM_RECKLESS
       if (!(SCM_REALP (x)))
        {
        badx:
          SCM_WTA_DISPATCH_1 (g_positive_p, x, SCM_ARG1, s_positive_p);
        }
-#endif
 #else
       SCM_GASSERT1 (SCM_NIMP (x) && SCM_REALP (x),
                    g_positive_p, x, SCM_ARG1, s_positive_p);
@@ -2989,13 +2971,11 @@ scm_negative_p (x)
       SCM_ASRTGO (SCM_NIMP (x), badx);
       if (SCM_BIGP (x))
        return SCM_TYP16 (x) == scm_tc16_bigpos ? SCM_BOOL_F : SCM_BOOL_T;
-#ifndef SCM_RECKLESS
       if (!(SCM_REALP (x)))
        {
        badx:
          SCM_WTA_DISPATCH_1 (g_negative_p, x, SCM_ARG1, s_negative_p);
        }
-#endif
 #else
       SCM_GASSERT1 (SCM_NIMP (x) && SCM_REALP (x),
                    g_negative_p, x, SCM_ARG1, s_negative_p);
@@ -3030,20 +3010,20 @@ scm_max (x, y)
 #endif
   if (SCM_UNBNDP (y))
     {
-#ifndef SCM_RECKLESS
-      if (!(SCM_NUMBERP (x)))
-       {
-       badx:
-         SCM_WTA_DISPATCH_2 (g_max, x, y, SCM_ARG1, s_max);
-       }
-#endif
+      SCM_GASSERT0 (!SCM_UNBNDP (x),
+                   g_max, scm_makfrom0str (s_max), SCM_WNA, 0);
+      SCM_GASSERT1 (SCM_NUMBERP (x), g_max, x, SCM_ARG1, s_max);
       return x;
     }
 #ifdef SCM_FLOATS
   if (SCM_NINUMP (x))
     {
 #ifdef SCM_BIGDIG
-      SCM_ASRTGO (SCM_NIMP (x), badx);
+      if (!SCM_NIMP (x))
+       {
+       badx2:
+         SCM_WTA_DISPATCH_2 (g_max, x, y, SCM_ARG1, s_max);
+       }
       if (SCM_BIGP (x))
        {
          if (SCM_INUMP (y))
@@ -3055,7 +3035,7 @@ scm_max (x, y)
          z = scm_big2dbl (x);
          return (z < SCM_REALPART (y)) ? y : scm_makdbl (z, 0.0);
        }
-      SCM_ASRTGO (SCM_REALP (x), badx);
+      SCM_ASRTGO (SCM_REALP (x), badx2);
 #else
       SCM_GASSERT2 (SCM_NIMP (x) && SCM_REALP (x),
                    g_max, x, y, SCM_ARG1, s_max);
@@ -3082,21 +3062,17 @@ scm_max (x, y)
       SCM_ASRTGO (SCM_NIMP (y), bady);
       if (SCM_BIGP (y))
        return SCM_BIGSIGN (y) ? x : y;
-#ifndef SCM_RECKLESS
       if (!(SCM_REALP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_max, x, y, SCM_ARGn, s_max);
        }
-#endif
 #else
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_REALP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_max, x, y, SCM_ARGn, s_max);
        }
-#endif
 #endif
       return (((z = SCM_INUM (x)) < SCM_REALPART (y))
              ? y
@@ -3115,13 +3091,11 @@ scm_max (x, y)
     }
   if (SCM_NINUMP (y))
     {
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_BIGP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_max, x, y, SCM_ARGn, s_max);
        }
-#endif
       return SCM_BIGSIGN (y) ? x : y;
     }
 #else
@@ -3147,20 +3121,20 @@ scm_min (x, y)
 #endif
   if (SCM_UNBNDP (y))
     {
-#ifndef SCM_RECKLESS
-      if (!(SCM_NUMBERP (x)))
-       {
-       badx:
-         SCM_WTA_DISPATCH_2 (g_min, x, y, SCM_ARG1, s_min);
-       }
-#endif
+      SCM_GASSERT0 (!SCM_UNBNDP (x),
+                   g_min, scm_makfrom0str (s_min), SCM_WNA, 0);
+      SCM_GASSERT1 (SCM_NUMBERP (x), g_min, x, SCM_ARG1, s_min);
       return x;
     }
 #ifdef SCM_FLOATS
   if (SCM_NINUMP (x))
     {
 #ifdef SCM_BIGDIG
-      SCM_ASRTGO (SCM_NIMP (x), badx);
+      if (!(SCM_NIMP (x)))
+       {
+       badx2:
+         SCM_WTA_DISPATCH_2 (g_min, x, y, SCM_ARG1, s_min);
+       }
       if (SCM_BIGP (x))
        {
          if (SCM_INUMP (y))
@@ -3172,7 +3146,7 @@ scm_min (x, y)
          z = scm_big2dbl (x);
          return (z > SCM_REALPART (y)) ? y : scm_makdbl (z, 0.0);
        }
-      SCM_ASRTGO (SCM_REALP (x), badx);
+      SCM_ASRTGO (SCM_REALP (x), badx2);
 #else
       SCM_GASSERT2 (SCM_NIMP (x) && SCM_REALP (x),
                    g_min, x, y, SCM_ARG1, s_min);
@@ -3199,21 +3173,17 @@ scm_min (x, y)
       SCM_ASRTGO (SCM_NIMP (y), bady);
       if (SCM_BIGP (y))
        return SCM_BIGSIGN (y) ? y : x;
-#ifndef SCM_RECKLESS
       if (!(SCM_REALP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_min, x, y, SCM_ARGn, s_min);
        }
-#endif
 #else
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_REALP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_min, x, y, SCM_ARGn, s_min);
        }
-#endif
 #endif
       return (((z = SCM_INUM (x)) > SCM_REALPART (y))
              ? y
@@ -3232,13 +3202,11 @@ scm_min (x, y)
     }
   if (SCM_NINUMP (y))
     {
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_BIGP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_min, x, y, SCM_ARGn, s_min);
        }
-#endif
       return SCM_BIGSIGN (y) ? y : x;
     }
 #else
@@ -3263,13 +3231,7 @@ scm_sum (x, y)
     {
       if (SCM_UNBNDP (x))
        return SCM_INUM0;
-#ifndef SCM_RECKLESS
-      if (!(SCM_NUMBERP (x)))
-       {
-       badx:
-         SCM_WTA_DISPATCH_2 (g_sum, x, y, SCM_ARG1, s_sum);
-       }
-#endif
+      SCM_GASSERT1 (SCM_NUMBERP (x), g_sum, x, SCM_ARG1, s_sum);
       return x;
     }
 #ifdef SCM_FLOATS
@@ -3277,7 +3239,11 @@ scm_sum (x, y)
     {
       SCM t;
 #ifdef SCM_BIGDIG
-      SCM_ASRTGO (SCM_NIMP (x), badx);
+      if (!SCM_NIMP (x))
+       {
+       badx2:
+         SCM_WTA_DISPATCH_2 (g_sum, x, y, SCM_ARG1, s_sum);
+       }
       if (SCM_BIGP (x))
        {
          if (SCM_INUMP (y))
@@ -3305,9 +3271,9 @@ scm_sum (x, y)
          return scm_makdbl (scm_big2dbl (x) + SCM_REALPART (y),
                             SCM_CPLXP (y) ? SCM_IMAG (y) : 0.0);
        }
-      SCM_ASRTGO (SCM_INEXP (x), badx);
+      SCM_ASRTGO (SCM_INEXP (x), badx2);
 #else
-      SCM_ASRTGO (SCM_NIMP (x) && SCM_INEXP (x), badx);
+      SCM_ASRTGO (SCM_NIMP (x) && SCM_INEXP (x), badx2);
 #endif
       if (SCM_INUMP (y))
        {
@@ -3325,21 +3291,17 @@ scm_sum (x, y)
          y = t;
          goto bigreal;
        }
-#ifndef SCM_RECKLESS
       else if (!(SCM_INEXP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_sum, x, y, SCM_ARGn, s_sum);
        }
-#endif
 #else
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_INEXP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_sum, x, y, SCM_ARGn, s_sum);
        }
-#endif
 #endif
       {
        double i = 0.0;
@@ -3385,7 +3347,7 @@ scm_sum (x, y)
   if (SCM_NINUMP (x))
     {
       SCM t;
-      SCM_ASRTGO (SCM_NIMP (x) && SCM_BIGP (x), badx);
+      SCM_ASRTGO (SCM_NIMP (x) && SCM_BIGP (x), badx2);
       if (SCM_INUMP (y))
        {
          t = x;
@@ -3405,13 +3367,11 @@ scm_sum (x, y)
     }
   if (SCM_NINUMP (y))
     {
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_BIGP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_sum, x, y, SCM_ARGn, s_sum);
        }
-#endif
     intbig:
       {
 #ifndef SCM_DIGSTOOBIG
@@ -3425,7 +3385,7 @@ scm_sum (x, y)
       }
     }
 #else
-  SCM_ASRTGO (SCM_INUMP (x), badx);
+  SCM_ASRTGO (SCM_INUMP (x), badx2);
   SCM_GASSERT2 (SCM_INUMP (y), g_sum, x, y, SCM_ARGn, s_sum);
 #endif
 #endif
@@ -3457,13 +3417,21 @@ scm_difference (x, y)
 #ifdef SCM_FLOATS
   if (SCM_NINUMP (x))
     {
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (x)))
        {
-       badx:
-         SCM_WTA_DISPATCH_2 (g_difference, x, y, SCM_ARG1, s_difference);
+         if (SCM_UNBNDP (y))
+           {
+             SCM_GASSERT0 (!SCM_UNBNDP (x), g_difference,
+                           scm_makfrom0str (s_difference), SCM_WNA, 0);
+           badx:
+             SCM_WTA_DISPATCH_1 (g_difference, x, SCM_ARG1, s_difference);
+           }
+         else
+           {
+           badx2:
+             SCM_WTA_DISPATCH_2 (g_difference, x, y, SCM_ARG1, s_difference);
+           }
        }
-#endif
       if (SCM_UNBNDP (y))
        {
 #ifdef SCM_BIGDIG
@@ -3498,13 +3466,13 @@ scm_difference (x, y)
          return scm_makdbl (scm_big2dbl (x) - SCM_REALPART (y),
                             SCM_CPLXP (y) ? -SCM_IMAG (y) : 0.0);
        }
-      SCM_ASRTGO (SCM_INEXP (x), badx);
+      SCM_ASRTGO (SCM_INEXP (x), badx2);
       if (SCM_BIGP (y))
        return scm_makdbl (SCM_REALPART (x) - scm_big2dbl (y),
                           SCM_CPLXP (x) ? SCM_IMAG (x) : 0.0);
       SCM_ASRTGO (SCM_INEXP (y), bady);
 #else
-      SCM_ASRTGO (SCM_INEXP (x), badx);
+      SCM_ASRTGO (SCM_INEXP (x), badx2);
       SCM_ASRTGO (SCM_NIMP (y) && SCM_INEXP (y), bady);
 #endif
       if (SCM_CPLXP (x))
@@ -3541,21 +3509,17 @@ scm_difference (x, y)
                             y, 0x0100);
 #endif
        }
-#ifndef SCM_RECKLESS
       if (!(SCM_INEXP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_difference, x, y, SCM_ARGn, s_difference);
        }
-#endif
 #else
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_INEXP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_difference, x, y, SCM_ARGn, s_difference);
        }
-#endif
 #endif
       return scm_makdbl (SCM_INUM (x) - SCM_REALPART (y),
                         SCM_CPLXP (y) ? -SCM_IMAG (y) : 0.0);
@@ -3600,13 +3564,11 @@ scm_difference (x, y)
     }
   if (SCM_NINUMP (y))
     {
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_BIGP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_difference, x, y, SCM_ARGn, s_difference);
        }
-#endif
       {
 #ifndef SCM_DIGSTOOBIG
        long z = scm_pseudolong (SCM_INUM (x));
@@ -3660,13 +3622,7 @@ scm_product (x, y)
     {
       if (SCM_UNBNDP (x))
        return SCM_MAKINUM (1L);
-#ifndef SCM_RECKLESS
-      if (!(SCM_NUMBERP (x)))
-       {
-       badx:
-         SCM_WTA_DISPATCH_2 (g_product, x, y, SCM_ARG1, s_product);
-       }
-#endif
+      SCM_GASSERT1 (SCM_NUMBERP (x), g_product, x, SCM_ARG1, s_product);
       return x;
     }
 #ifdef SCM_FLOATS
@@ -3674,7 +3630,11 @@ scm_product (x, y)
     {
       SCM t;
 #ifdef SCM_BIGDIG
-      SCM_ASRTGO (SCM_NIMP (x), badx);
+      if (!SCM_NIMP (x))
+       {
+       badx2:
+         SCM_WTA_DISPATCH_2 (g_product, x, y, SCM_ARG1, s_product);
+       }
       if (SCM_BIGP (x))
        {
          if (SCM_INUMP (y))
@@ -3697,9 +3657,9 @@ scm_product (x, y)
                               SCM_CPLXP (y) ? bg * SCM_IMAG (y) : 0.0);
          }
        }
-      SCM_ASRTGO (SCM_INEXP (x), badx);
+      SCM_ASRTGO (SCM_INEXP (x), badx2);
 #else
-      SCM_ASRTGO (SCM_NIMP (x) && SCM_INEXP (x), badx);
+      SCM_ASRTGO (SCM_NIMP (x) && SCM_INEXP (x), badx2);
 #endif
       if (SCM_INUMP (y))
        {
@@ -3717,21 +3677,17 @@ scm_product (x, y)
          y = t;
          goto bigreal;
        }
-#ifndef SCM_RECKLESS
       else if (!(SCM_INEXP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_product, x, y, SCM_ARGn, s_product);
        }
-#endif
 #else
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_INEXP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_product, x, y, SCM_ARGn, s_product);
        }
-#endif
 #endif
       if (SCM_CPLXP (x))
        {
@@ -3787,7 +3743,7 @@ scm_product (x, y)
 #ifdef SCM_BIGDIG
   if (SCM_NINUMP (x))
     {
-      SCM_ASRTGO (SCM_NIMP (x) && SCM_BIGP (x), badx);
+      SCM_ASRTGO (SCM_NIMP (x) && SCM_BIGP (x), badx2);
       if (SCM_INUMP (y))
        {
          SCM t = x;
@@ -3802,13 +3758,11 @@ scm_product (x, y)
     }
   if (SCM_NINUMP (y))
     {
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_BIGP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_product, x, y, SCM_ARGn, s_product);
        }
-#endif
     intbig:
       if (SCM_INUM0 == x)
        return x;
@@ -3830,7 +3784,7 @@ scm_product (x, y)
       }
     }
 #else
-  SCM_ASRTGO (SCM_INUMP (x), badx);
+  SCM_ASRTGO (SCM_INUMP (x), badx2);
   SCM_GASSERT (SCM_INUMP (y), g_product, x, y, SCM_ARGn, s_product);
 #endif
 #endif
@@ -3905,13 +3859,21 @@ scm_divide (x, y)
   double d, r, i, a;
   if (SCM_NINUMP (x))
     {
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (x)))
        {
-       badx:
-         SCM_WTA_DISPATCH_2 (g_divide, x, y, SCM_ARG1, s_divide);
+         if (SCM_UNBNDP (y))
+           {
+             SCM_GASSERT0 (!SCM_UNBNDP (x),
+                           g_divide, scm_makfrom0str (s_divide), SCM_WNA, 0);
+           badx:
+             SCM_WTA_DISPATCH_1 (g_divide, x, SCM_ARG1, s_divide);
+           }
+         else
+           {
+           badx2:
+             SCM_WTA_DISPATCH_2 (g_divide, x, y, SCM_ARG1, s_divide);
+           }
        }
-#endif
       if (SCM_UNBNDP (y))
        {
 #ifdef SCM_BIGDIG
@@ -3981,7 +3943,7 @@ scm_divide (x, y)
          goto complex_div;
        }
 #endif
-      SCM_ASRTGO (SCM_INEXP (x), badx);
+      SCM_ASRTGO (SCM_INEXP (x), badx2);
       if (SCM_INUMP (y))
        {
          d = SCM_INUM (y);
@@ -4026,21 +3988,17 @@ scm_divide (x, y)
       SCM_ASRTGO (SCM_NIMP (y), bady);
       if (SCM_BIGP (y))
        return scm_makdbl (SCM_INUM (x) / scm_big2dbl (y), 0.0);
-#ifndef SCM_RECKLESS
       if (!(SCM_INEXP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_divide, x, y, SCM_ARGn, s_divide);
        }
-#endif
 #else
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_INEXP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_divide, x, y, SCM_ARGn, s_divide);
        }
-#endif
 #endif
       if (SCM_REALP (y))
        return scm_makdbl (SCM_INUM (x) / SCM_REALPART (y), 0.0);
@@ -4111,13 +4069,11 @@ scm_divide (x, y)
     }
   if (SCM_NINUMP (y))
     {
-#ifndef SCM_RECKLESS
       if (!(SCM_NIMP (y) && SCM_BIGP (y)))
        {
        bady:
          SCM_WTA_DISPATCH_2 (g_divide, x, y, SCM_ARGn, s_divide);
        }
-#endif
       goto ov;
     }
 #else
@@ -4382,13 +4338,11 @@ scm_real_part (z)
       SCM_ASRTGO (SCM_NIMP (z), badz);
       if (SCM_BIGP (z))
        return z;
-#ifndef SCM_RECKLESS
       if (!(SCM_INEXP (z)))
        {
        badz:
          SCM_WTA_DISPATCH_1 (g_real_part, z, SCM_ARG1, s_real_part);
        }
-#endif
 #else
       SCM_GASSERT1 (SCM_NIMP (z) && SCM_INEXP (z),
                    g_real_part, z, SCM_ARG1, s_real_part);
@@ -4413,13 +4367,11 @@ scm_imag_part (z)
   SCM_ASRTGO (SCM_NIMP (z), badz);
   if (SCM_BIGP (z))
     return SCM_INUM0;
-#ifndef SCM_RECKLESS
   if (!(SCM_INEXP (z)))
     {
     badz:
       SCM_WTA_DISPATCH_1 (g_imag_part, z, SCM_ARG1, s_imag_part);
     }
-#endif
 #else
   SCM_GASSERT1 (SCM_NIMP (z) && SCM_INEXP (z),
                g_imag_part, z, SCM_ARG1, s_imag_part);
@@ -4443,13 +4395,11 @@ scm_magnitude (z)
   SCM_ASRTGO (SCM_NIMP (z), badz);
   if (SCM_BIGP (z))
     return scm_abs (z);
-#ifndef SCM_RECKLESS
   if (!(SCM_INEXP (z)))
     {
     badz:
       SCM_WTA_DISPATCH_1 (g_magnitude, z, SCM_ARG1, s_magnitude);
     }
-#endif
 #else
   SCM_GASSERT1 (SCM_NIMP (z) && SCM_INEXP (z),
                g_magnitude, z, SCM_ARG1, s_magnitude);
@@ -4484,13 +4434,11 @@ scm_angle (z)
       x = (SCM_TYP16 (z) == scm_tc16_bigpos) ? 1.0 : -1.0;
       goto do_angle;
     }
-#ifndef SCM_RECKLESS
   if (!(SCM_INEXP (z)))
     {
     badz:
       SCM_WTA_DISPATCH_1 (g_angle, z, SCM_ARG1, s_angle);
     }
-#endif
 #else
   SCM_GASSERT1 (SCM_NIMP (z) && SCM_INEXP (z), g_angle, z, SCM_ARG1, s_angle);
 #endif