Multiply Function [x]
|
08-03-2018, 06:45 PM
Post: #9
|
|||
|
|||
RE: Multiply Function [x]
(08-03-2018 02:40 PM)Dieter Wrote: There was a series of HP Journal articles that described how calculators do their calculations. I remember something about log, exponential and trig functions, and maybe there also was something about multiplication and division. This is the relevant MCODE of the HP-41 for the multiplication: Code: ***************************************************** This line adds the exponents: Code: 144 125 1006 C=A+C X The algorithm uses the same digit by digit method we use when we manually calculate the product of two numbers. The accumulator A keeps track of the sum. The mantissa of one number is kept in B and continuously added to A while the mantissa of the other number in C is decremented digit by digit: Code: 154 137 MPY130 456 A=A+B W Once a digit of C is done the pointer PT is incremented and the accumulator A is shifted: Code: 151 134 MPY120 1734 INC PT Easiest of course is to follow the program step by step in the debugger of an emulator. Cheers Thomas PS: The algorithm is similar to the binary multiplication of my previous post. However base 10 instead of base 2 is used. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)