Algorithm for entering numbers?

08202019, 07:51 AM
Post: #21




RE: Algorithm for entering numbers?
(08192019 06:29 PM)Albert Chan Wrote: Say, 99 is stored in memory 00, "RCL 00" should be equivalent to "99 Enter" Actually, no it shouldn't. The big difference between RCL 00 and "99 [ENTER]" is the fact that the second leaves 99 in both X and Y and disables stack lift. the first just places 99 in X and does not disable stack lift. There are only 10 types of people in this world. Those who understand binary and those who don't. 

08202019, 11:07 AM
(This post was last modified: 08202019 11:36 AM by Thomas Okken.)
Post: #22




RE: Algorithm for entering numbers?
(08192019 06:29 PM)Albert Chan Wrote: What is the rationale for Enter disable stacklift ? One of the functions of the ENTER key is filling the stack, so you can take advantage of the way T is duplicated when the stack drops, in order to perform repeated additions or multiplications. For example, to observe how a number grows when multiplied repeatedly by a constant factor, you can do factor ENTER ENTER ENTER number × × × × × ... Doing this requires ENTER to duplicate the number in X, and not merely have the effect of ending number entry mode. But that means that when ending number entry mode is the desired effect, you'll want to prevent the duplication from cluttering up the stack unnecessarily, and that is accomplished by disabling stack lift. The way the RPL calculators deal with the two uses of ENTER is different but accomplishes the same thing: in number entry mode (or more generally, any kind of entry on the command line), it ends entry mode, placing the entered number in X, also known as Level 1, without duplicating anything, while when not in entry mode, ENTER performs DUP. So the details of the operation are different, but the results are almost the same, to the point where I don't really think about the difference when switching back and forth between the two systems. I think the RPL approach is a bit more elegant because it handles the case where you specifically want just duplication better; on the HP41C and 42S, you have to resort to the somewhat inelegant RCL ST X to achieve the same effect. For example, if you want to multiply the number in X by 10, while also preserving the original number on the stack, on a calculator like the HP67 you'd have to do ENTER ENTER 10 ×, needing the second ENTER in because the stackliftdisabling behavior is not desired here and needs to be worked around; on the HP42S you could do RCL ST X 10 × (or 10 RCL× ST Y, but I digress), while the RPL approach is DUP 10 ×, which is actually the clearest of the three to read. 

08202019, 11:29 AM
Post: #23




RE: Algorithm for entering numbers?
(08202019 11:07 AM)Thomas Okken Wrote: on the HP41C and 42S, you have to resort to the somewhat inelegant RCL ST X to achieve the same effect. Or [ENTER] [X<>Y] Because [ENTER] does duplicate X into Y, the sole function of [X<>Y] is to reenable stack lift after [ENTER] left it disabled. There are only 10 types of people in this world. Those who understand binary and those who don't. 

« Next Oldest  Next Newest »

User(s) browsing this thread: