(12C) Modulus

07252016, 09:17 AM
(This post was last modified: 07252016 10:10 AM by Dieter.)
Post: #5




RE: (12C) Modulus
(07182016 10:12 PM)bshoring Wrote: Here's a routine I wrote about a month ago. One step longer, but it uses only the stack and LastX register. Great. In the meantime I got exactly the same solution. Many/most other HPs offer a R↑ which can replace the three consecutive R↓, making the program even shorter. (07212016 11:36 PM)RobertM Wrote: From "ENTER: Reverse Polish Notation Made Easy", JeanDaniel Dodin / Keith Jarett, (pg 115): That's a nice one as well. Here's another 10/11 step solution: Code: 01 ENTER The first four lines copy the content of Y to Z and T while X and Y are left unchanged. However, all these solutions destroy the stack, while the version I initially posted keeps the values of Z and T. That's why it requires one data register. I wonder if it is possible to do it only with the stack, i.e. without a data register, while Z and T are still preserved. Here's another challenge: what about returning y mod x as well as y div x (i.e. the integer quotient of y and x). There are many applications where both values are required at the same time. That's why I once suggested a DIVMOD command for the 34s that returns these two values. Now, what do you think ?) Dieter 

« Next Oldest  Next Newest »

Messages In This Thread 
(12C) Modulus  Eddie W. Shore  07152016, 02:37 AM
RE: (12C) Modulus  Dieter  07152016, 06:32 PM
RE: (12C) Modulus  bshoring  07182016, 10:12 PM
RE: (12C) Modulus  RobertM  07212016, 11:36 PM
RE: (12C) Modulus  Dieter  07252016 09:17 AM
RE: (12C) Modulus  Dieter  07252016, 09:46 AM
RE: (12C) Modulus  bshoring  07282016, 11:01 PM
RE: (12C) Modulus  Dieter  07292016, 05:39 PM

User(s) browsing this thread: 1 Guest(s)