|  3DSoftware.com > Programming > Integers > Page 7 |
|
Integers
Page 7
Wide Unsigned Integers High and Low Multiplication When you multiply two wide unsigned integers that occupy the same amount of memory (number of bytes), the product takes up twice as much memory. For example, the product of two We listed polynomials for generating such products in the previous page of this article (opens new browser window). We now turn to the problem of working with numbers that all take the same amount of storage space. For example, when multiplying two |
|
We showed how to multiply two |
||
|
||
|
The following equation calculates the |
||
|
||
|
The low order |
|
To multiply two |
||
|
||
|
The low order Overflow To implement a system, of making the total product use the same amount of storage as the operands, involves checking for overflow of multiplication. If the product of two numbers is too large to fit in the storage space allocated for a single number, overflow occurs. High multiplication (calculation of Y128 and Y256 in the examples above) is not performed, but the factors of the terms that would have been used for high multiplication are compared to zero. If any of the terms for high multiplication would be non-zero, there is overflow. If the high multiplication coefficients would all be zero, the next step is to perform the low multiplication, which was the calculation of X160 and X288 in the examples above. Each coefficient (factor of t^n) in the polynomial for low multiplication is a partial product. The result (total product) of the low multiplication is the summation of those partial products. Each partial product is a To convert a partial product from In our WideInteger implementation, each digit is |
| Page 7 | ||||
|
|
Copyright © 2008 by 3D Software. All rights reserved. 3D Software, P.O. Box 221190, Sacramento CA 95822 USA www.3DSoftware.com Contact us |
| Thursday, 20-Nov-2008 13:27:18 GMT |