Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site linus.UUCP Path: utzoo!linus!graceh From: graceh@linus.UUCP (Grace L. Hammonds) Newsgroups: net.bugs.4bsd,net.unix-wizards Subject: Re: Bug in multiprecision arithmetic, libmp Message-ID: <239@linus.UUCP> Date: Wed, 3-Aug-83 17:20:07 EDT Article-I.D.: linus.239 Posted: Wed Aug 3 17:20:07 1983 Date-Received: Wed, 3-Aug-83 21:21:45 EDT References: <26948@linus.UUCP> Organization: MITRE Corp., Bedford MA Lines: 24 The bug in the libmp division routine, mdiv, that I reported earlier has been solved by changing a declaration in the m_dsb subroutine of the mdiv.c file. The variable 'u' should be declared short instead of int. My thanks to watdaisy!dtaylor for this solution. For those who may have missed the original posting, the problem was described this way: ---- I discovered the bug when I tried to divide a 10-digit number into twice that number less one. The remainder should have been the divisor less one, but it was much too low. The trouble seems to start at 1073741825 = 2^30+1 (I haven't been able to get it to fail at numbers smaller than that), where I get the following results: (2 * (2^30+1) - 1) mod (2^30+1) = 2^30-2, instead of 2^30 Using 2^30+3: (2 * (2^30+3) - 1) mod (2^30+3) = 2^30-(2^16), instead of 2^30+2 -- --Grace Hammonds {allegra,genrad,ihnp4,utzoo,philabs,uw-beaver}!linus!graceh (UUCP) linus!graceh@mitre-bedford (ARPA)