From: Chris Hanson Date: Wed, 16 May 1990 22:42:55 +0000 (+0000) Subject: In bignum division when doing add-back because initial guess was too X-Git-Tag: 20090517-FFI~11404 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=5ef592f30c465e05653b19ac78e67317fac7c481;p=mit-scheme.git In bignum division when doing add-back because initial guess was too large: if the add-back causes a carry it must be discarded. --- diff --git a/v7/src/microcode/bignum.c b/v7/src/microcode/bignum.c index f6c0bf5f7..93bc76838 100644 --- a/v7/src/microcode/bignum.c +++ b/v7/src/microcode/bignum.c @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/bignum.c,v 9.30 1990/02/11 22:34:00 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/bignum.c,v 9.31 1990/05/16 22:42:04 cph Exp $ Copyright (c) 1989, 1990 Massachusetts Institute of Technology @@ -1208,7 +1208,10 @@ bignum_divide_subtract (v_start, v_end, guess, u_start) } } if (carry == 1) - (*u_scan) += 1; + { + bignum_digit_type sum = ((*u_scan) + carry); + (*u_scan) = ((sum < BIGNUM_RADIX) ? sum : (sum - BIGNUM_RADIX)); + } return (guess - 1); } diff --git a/v7/src/microcode/version.h b/v7/src/microcode/version.h index 23c4c4abd..e87010dbe 100644 --- a/v7/src/microcode/version.h +++ b/v7/src/microcode/version.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.30 1990/04/17 22:20:34 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/microcode/Attic/version.h,v 11.31 1990/05/16 22:42:55 cph Exp $ Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology @@ -46,7 +46,7 @@ MIT in each case. */ #define VERSION 11 #endif #ifndef SUBVERSION -#define SUBVERSION 30 +#define SUBVERSION 31 #endif #ifndef UCODE_TABLES_FILENAME diff --git a/v8/src/microcode/version.h b/v8/src/microcode/version.h index eaf287986..3fe71f40c 100644 --- a/v8/src/microcode/version.h +++ b/v8/src/microcode/version.h @@ -1,6 +1,6 @@ /* -*-C-*- -$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.30 1990/04/17 22:20:34 cph Exp $ +$Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v8/src/microcode/version.h,v 11.31 1990/05/16 22:42:55 cph Exp $ Copyright (c) 1988, 1989, 1990 Massachusetts Institute of Technology @@ -46,7 +46,7 @@ MIT in each case. */ #define VERSION 11 #endif #ifndef SUBVERSION -#define SUBVERSION 30 +#define SUBVERSION 31 #endif #ifndef UCODE_TABLES_FILENAME