Multiply Function [x]
|
08-03-2018, 02:40 PM
(This post was last modified: 08-03-2018 05:32 PM by Dieter.)
Post: #7
|
|||
|
|||
RE: Multiply Function [x]
(08-03-2018 09:27 AM)Gamo Wrote: I'm wondering what algorithm is use in calculator for the multiply function. 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. (08-03-2018 09:27 AM)Gamo Wrote: Example: 6903 x 103 When I ran this it returned 711012,14. Why is that? Register 2 happened to have pi stored in it (from a previous calculation – the 12C has continuous memory). And your program does not clear this register before it starts adding! I have mentioned this point several times: always clear a sum before you start adding data! Clearing the sum afterwards, as your program does it, is not a solution. (08-03-2018 09:27 AM)Gamo Wrote: Step can be reverse: 103 [ENTER] 6903 [R/S] ---> 711009 But the program takes much longer to finish. You should start with the smaller number in X. Why not have the program care for this? Simply start with X<=Y? X<>Y X<>Y You can also speed up (and shorten) the program by using storage arithmetics. Edit: here's my attempt of such a program. Only one data register is required. Code: 01 X<=Y? Note: the smaller (!) of the two factors must be an integer ≥0. If there is a fractional part it is discarded. The larger factor may be fractional. 123,4 [ENTER] 17 [R/S] => 2097,80 17 [ENTER] 123,4 [R/S] => 2097,80 Dieter |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 5 Guest(s)