Path: utzoo!utgpu!water!watmath!clyde!bellcore!rutgers!ucla-cs!sonia!dgc From: dgc@sonia.math.ucla.edu (David G. Cantor) Newsgroups: comp.arch Subject: Re: more on unsigned Keywords: Multiple precision, multipication Message-ID: <13223@shemp.CS.UCLA.EDU> Date: 6 Jun 88 21:56:05 GMT References: <2433@uvacs.CS.VIRGINIA.EDU> <792@l.cc.purdue.edu> Sender: news@CS.UCLA.EDU Reply-To: dgc@sonia.MATH.UCLA.EDU (David G. Cantor) Organization: UCLA Department of Mathematics Lines: 37 Summary: Expires: Sender: Followup-To: Distribution: In article <792@l.cc.purdue.edu> cik@l.cc.purdue.edu (Herman Rubin) writes: . . . one can do multiple precision arithmetic without unsigned arithmetic. It is not too difficult to do it in sign-magnitude arithmetic, and a method has been proposed many years ago to use both signs and allow a little stretch to avoid carry propagation. Since not everyone is familiar with this, in base 10 the digits would go from -5 to 4, but carry would extend the range to -6 to 5. Note that this loses a bit due to ambiguities. However, every computer I have seen since the IBM 70x(x) series does not compute double products of signed numbers in such a useful manner! They all produce the product as a signed number followed by an unsigned number. Now if the unsigned number has its leading bit a forced 0, one can do as Bill suggests for multiple precision. The great majority of computers do not have this feature. In that case, one must resort to slightly less than half word arithmetic or other kludges. product with the least significant part unsigned. ------------------------------------------------------------------------ It is very easy to correrct for this: What most computers do is take two n-bit two's-complement numbers and form a 2n-bit two's-complement number. What you want to do is to take the the latter number and rewrite is as 2 n-bit two's-complement numbers, say a and b, so that it equals a*2^n + b. This is easily done: Split the 2n-bit number into the two n-bit numbers a and b by taking the left and right halves, respectively. Then if the right half b is negative (has a leading 1) subtract 1 from the left half a. dgc David G. Cantor Internet: dgc@math.ucla.edu UUCP: ...!{ihnp4, randvax, sdcrdcf, ucbvax}!ucla-cs!dgc