The Museum of HP Calculators

HP Forum Archive 15

 Categorized programmersMessage #1 Posted by Tizedes Csaba on 27 May 2005, 2:39 a.m. Hello! Many years ago, I found an article (only a text file?) about the types of RPN programmers. This text categorised the programmers into 10-15 case. The exercise was how can you change the number in the stack_x from '0' to '1' or from '1' to '0'. Where can I find this text? Thanks! Csaba

 Re: Categorized programmersMessage #2 Posted by Raymond Del Tondo on 27 May 2005, 7:31 a.m.,in response to message #1 by Tizedes Csaba Hi, there's a chance that it could be in the museum archives, or maybe in the comp.sys.hp48 archives. I don't remember if the solutions were categorized, but I think there was a thread about the best way to toggle 1 and 0. Raymond

 Re: Categorized programmersMessage #3 Posted by GWB on 27 May 2005, 7:06 p.m.,in response to message #1 by Tizedes Csaba Perhaps this one from Joe Horn's HP-48 page? Regards, Gerson. -------------------------- Here is the link to the original PPC article, see pages 31-32: --------------------------- The toggle was between 1 and 2. Joe Horn wrote (first link): Quote: [Postscript: In the next issue of the PPC Journal (V5 N9 P5), Richard Nelson wrote the following. -jkh-] ```--------------------------------------------------------------------- A number of 'programmers' at HP also took the test... and as luck would have it, one produced number 13! Another HP programmer's solution was a three-step goodie listed below (a). The "best" has to be Mike Richter's program in (b) below. It is the shortest (will someone come up with a two-step program?), doesn't use any compares, labels, flags, registers, or even the stack! [Note: this was very important on 4-level stack machines! -jkh-] (a) 2 / 1/x [or 1/x 2 * -jkh-] (b) 1/x e^x INT ``` Well, I have just come up with a two-step program (actually a 9-byte program) for the HP-42S (as long as 01 LBL "T" and 04 END don't count as steps). Not a universal RPN program though, as it runs only on the 42S as far as I know. Anyone curious for the missing lines 02 and 03? I found it in less than 3 or 4 minutes (Luckily I tried the 42S first). Edited: 27 May 2005, 9:48 p.m.

 Re: Categorized programmers -- Spoiler for HP41/42?Message #4 Posted by Tony Duell on 28 May 2005, 6:35 a.m.,in response to message #3 by GWB How about 1/X ST+ X That works on the HP41 anyhow.

 Re: Categorized programmers -- Spoiler for HP41/42?Message #5 Posted by Raymond Del Tondo on 28 May 2005, 7:50 a.m.,in response to message #4 by Tony Duell Very nice:-) Raymond

 Re: Categorized programmers -- Spoiler for HP41/42?Message #6 Posted by GWB on 28 May 2005, 10:48 a.m.,in response to message #4 by Tony Duell Tony Duell wrote: Quote: How about 1/X ST+ X Excellent! I am not that smart. Here is mine: 3 XOR -------------- Now, what categories these may be classified in? Edited: 28 May 2005, 10:55 a.m.

 A tiny solution for the 0<>1 toggleMessage #7 Posted by Andrés C. Rodríguez (Argentina) on 28 May 2005, 10:20 a.m.,in response to message #1 by Tizedes Csaba ``` A solution... as good as this other... 01 ASIN 01 ACOS 02 COS 02 SIN Two bytes, no conditionals, no modes-dependent, no stack use. ```

 Re: A tiny solution for the 0<>1 toggleMessage #8 Posted by GWB on 28 May 2005, 1:17 p.m.,in response to message #7 by Andrés C. Rodríguez (Argentina) Andrés C. Rodríguez (Argentina) wrote: Quote:```A solution... as good as this other... 01 ASIN 01 ACOS 02 COS 02 SIN Two bytes, no conditionals, no modes-dependent, no stack use.``` Very good and universal! (somewhat time-consuming though, but we know it is not easy to optimize programs both for speed and size at the same time). For the 48G series only, I would suggest this: NOT Best regards, Gerson (Brasil) Edited: 28 May 2005, 2:40 p.m.

 Re: Yet another 3-step solution for the 1<>2 toggleMessage #9 Posted by Andrés C. Rodríguez (Argentina) on 28 May 2005, 4:31 p.m.,in response to message #1 by Tizedes Csaba ``` 01 CHS 02 3 03 MOD Not as universal (modulo implementations may differ, as in the HP33S), uses 1 stack level... The already discussed 01 1/x 02 STO + ST X is the one I like most ``` Edited: 28 May 2005, 4:32 p.m.

 Re: Yet another 3-step solution for the 1<>2 toggleMessage #10 Posted by GWB on 28 May 2005, 5:19 p.m.,in response to message #9 by Andrés C. Rodríguez (Argentina) Quote:```01 CHS 02 3 03 MOD Not as universal (modulo implementations may differ, as in the HP33S), uses 1 stack level...``` ```Interesting one, not so universal as you pointed out. However, runs perfectly on the HP33S: . +/- 3 RMDR . By the way, there seems to be quite a few 3-step possibilities, like these ones for the 33S: . 2 x<>y nCr (or Cy,x for the 15C) . . 1/x -> CM IP . etc... The question is: what category do these ones fall into? :-) ``` Edited: 28 May 2005, 5:21 p.m.