(scm_gcd): In bignum/inum, don't pass yy==0 to mpz_gcd_ui
authorKevin Ryde <user42@zip.com.au>
Sat, 10 May 2003 00:20:05 +0000 (00:20 +0000)
committerKevin Ryde <user42@zip.com.au>
Sat, 10 May 2003 00:20:05 +0000 (00:20 +0000)
since we're only using the ulong return value, and x might not fit.

libguile/numbers.c

index 4a82873..c690763 100644 (file)
@@ -708,6 +708,8 @@ scm_gcd (SCM x, SCM y)
         {
           unsigned long result;
           long yy = SCM_INUM (y);
+          if (yy == 0)
+            return scm_abs (x);
           if (yy < 0) yy = -yy;
           result = mpz_gcd_ui (NULL, SCM_I_BIG_MPZ (x), yy);
           scm_remember_upto_here_1 (x);