(42S/DM42/Free42/Plus42) Multiply Large Numbers
|
06-12-2023, 12:58 AM
Post: #1
|
|||
|
|||
(42S/DM42/Free42/Plus42) Multiply Large Numbers
The program LRG× multiplies to two large integers, allowing answers to extend beyond 12 digit capacity. The product is shown in the alpha register. How is this possible? One way is to split the multiplier and multiplicand (also known as factors) into groups of digits.
Download the program here: largemultiply.raw Program Code: Code: 00 { 156-Byte Prgm } Notes: The program LRG× takes two integers from the stack. This is meant to work on positive, non-zero integers. Flag 29 is the thousands separator flag. Setting flag 29 turns them on while clearing it turns them off. In order to allow the alpha register have the long integer, flag 29 is cleared. Memory register R5 represents units while R6 represents the part in hundred-millions. The program switches the display to ALL mode. Source Hoffman, Dean and Mohler, Lee. Mathematical Recreations for the Programmable Calculator Hayden Book Company, Inc. Rochelle Park: New Jersey. 1982. pp 146-166. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)