(12C) Long Division
|
07-14-2018, 04:17 AM
(This post was last modified: 07-16-2018 01:57 PM by Gamo.)
Post: #1
|
|||
|
|||
(12C) Long Division
Recently I saw this Casio Calculator model MP-12R state that this calculator is best choice for the "Warehouse"
Functions specifically for warehouse operations. The main feature is the Remainder Calculation. More information about this model: https://www.casio-intl.com/mea/en/calc/products/MP-12R/ This reminded me of the "Long Division" I posted in this forum before and here is the updated version. Example: 960 ÷ 360 960 [ENTER] 360 [R/S] Answer: 240 [X<>Y] 2 Quotient 2 Remainder 240 Program: Long Division Quote:01 X<>Y Gamo |
|||
07-14-2018, 08:05 AM
Post: #2
|
|||
|
|||
RE: (12C) Long Division
Hello Gamo.
I remember laughing at this calculator when it brought up this feature because I knew I could program it into my 12C. Although they probably would laugh at me for having more than several calculators. You have a very unorthodox method of getting the answer. Very neat. This encourages me to show my program. It only consumes 8 steps although I would add an extra swap command at the end of my program just so I could have the remainder in the Y register. But it is a great feeling to create a program in the 12C and not convert any registers so I didn't. Code:
And I remember you like examples so I'll borrow yours for a second. Example: 960/360 960 [ENTER] 360 [R/S] --> 240 [SWAP] 2 |
|||
07-14-2018, 09:44 AM
Post: #3
|
|||
|
|||
RE: (12C) Long Division
Thanks Carson
Any idea is very welcome this give many different variations of styles in programming. I do have another version but used 3 registers I didn't include in this post because I know this will upset Dieter who don't like to use register if necessary so I try this all using stacks manipulation. Anyway I learn a lot from Dieter and thank you for his many tricks and tips. HP-12C is a very capable calculator it's just can do many math related things that people didn't expect that it can do. Gamo |
|||
07-14-2018, 05:08 PM
(This post was last modified: 07-14-2018 05:10 PM by Dieter.)
Post: #4
|
|||
|
|||
RE: (12C) Long Division
(07-14-2018 08:05 AM)Carsen Wrote: You have a very unorthodox method of getting the answer. Actually Gamo's method is not unorthodox but the preferred approach as it (mostly) avoids roundoff errors. You should never use FRAC when calculating the modulus as it may and will cause errors. Consider your example: the result is not 240 but 240,0000001. Then try 960 and 7, this returns a remainder of 0,999999700. (07-14-2018 08:05 AM)Carsen Wrote: I would add an extra swap command at the end of my program just so I could have the remainder in the Y register. Agreed. Here is my attempt. Like your version (and unlike Gamo's) it does not require a double ENTER to separate the two arguments. The initial commands push Y to the higher stack levels and then drop it down again. Code: 01 ENTER 960 [ENTER] 360 [R/S] => 2 [X<>Y] 240 (07-14-2018 08:05 AM)Carsen Wrote: But it is a great feeling to create a program in the 12C and not convert any registers so I didn't. That's one of the biggest advantages of RPN. You can do many things directly on the stack, without any data registers. Dieter |
|||
07-14-2018, 08:15 PM
Post: #5
|
|||
|
|||
RE: (12C) Long Division
(07-14-2018 05:08 PM)Dieter Wrote: [quote='Dieter' pid='100448' dateline='1531588120'] Ah. I understand now. Thank you for pointing out this error and I'll keep this in mind. (07-14-2018 05:08 PM)Dieter Wrote: The initial commands push Y to the higher stack levels and then drop it down again. I should remember the power of the T register when I program because I didn't think of using the T register at all when making my own program. (07-14-2018 09:44 AM)Gamo Wrote: HP-12C is a very capable calculator it's just can do many math related things that people didn't expect that it can do. Agreed. The power of programming is great. |
|||
07-15-2018, 02:50 AM
(This post was last modified: 07-15-2018 03:01 AM by Gamo.)
Post: #6
|
|||
|
|||
RE: (12C) Long Division
Here is another version for 11C or 15C by using the custom make program for the INT function to see the speed.
Code:
Example: 960 ÷ 360 960 [ENTER] [ENTER] 360 f [A] Answer: 420 [X<>Y] 2 Gamo |
|||
07-02-2021, 12:26 AM
Post: #7
|
|||
|
|||
RE: (12C) Long Division
Been a long time since no update for this Long Division routine.
This time the answer start with Quotient and Remainder. Program: Code:
Example: 1800 ÷ 240 1800 [ENTER] 240 [R/S] 7 [X<>Y] 120 Answer: Q = 7 and R = 120 Gamo 7/2021 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)