Fast multiplication (50 points). Do Exercise 5 on page 256, with the following enhancements: Display a program title and prompt the user for two integers. (ReadInt assumes the numbers are signed, but that's ok; we'll use the 32-bit signed range for the input values.) Call the FastMultiply procedure and display the product on the screen with an appropriate label. If the product is too large to be represented by 32 bits, display an error message. Right-click here to download the source code for my solution program. Here is another version Due Thurs, Nov. 14. Use the following test data, which should give valid results. I've numbered each test pair, which are cited on the graded programs:
test 1: 3 X 5 = 15 test 2: 1,000,000,000 X 4 = 4,000,000,000 test 3: 2,147,483,647 X 2 = 4,294,967,294 test 4: 16,777,216 X 10 = 167,772,160 test 5: 1,000,000,000 X 5 = "product too large" test 6: 2,100,000,000 X 3 = "product too large" optional test 7: 1024 X 10,000,000 = "product too large"
Extra: for 20 additional points, create a FastMultiply64 procedure that multiplies
two 32-bit decimal integers and produces a 64-bit result (displayed in hexadecimal).
Hint: use the SHLD instruction to perform a multi-doubleword shift. Note: I've
added a ReadDec procedure to the link library that reads a 32-bit unsigned integer
from standard input. To use it, download the most recent library patch.