Categorized programmers



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?





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.



Perhaps this one from Joe Horn's HP-48 page?




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):


[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.


How about

That works on the HP41 anyhow.


Very nice:-)



Tony Duell wrote:

How about 1/X ST+ X


I am not that smart. Here is mine:



Now, what categories these may be classified in?

Edited: 28 May 2005, 10:55 a.m.


A solution... as good as this other...

02 COS 02 SIN

Two bytes, no conditionals, no modes-dependent, no stack use.


Andrés C. Rodríguez (Argentina) wrote:

A solution...      as good as this other...
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:


Best regards,

Gerson (Brasil)

Edited: 28 May 2005, 2:40 p.m.


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.


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:

By the way, there seems to be quite a few 3-step possibilities, like these ones for the 33S:

nCr (or Cy,x for the 15C)

-> CM


The question is: what category do these ones fall into? :-)

Edited: 28 May 2005, 5:21 p.m.


Hello, Tizedes;

I see that many solutions on how to toggle 1 for 2 and 0 for 1 have been shown here, but I'd like to know if you found the document you're searching for.

You see, after reading your post I thought what sort of restrictions should apply, meannig what math or logical tools could be used. I immediately thought about the RPN programmable with the fewest tools available, and depending on what you want, some models fit in.

The HP12C has no trigonometrics and is yet programmable. The HP25 has all trigonometrics and has neither reminder (modulo) nor logical functions. The HP41 and the HP42 are the only two I know that allow the X-register contents to address other registers in the stack, itself included (ST+ X). Needless to say, RPL models offer either SYSRPL or assembly code...

As you remember finding the article, would you remember what restrictions applied to the test, if any? I mean, let's for one second consider only the basic stack manipulation ([ENTER], [Rolldown], [x<>y]), digit entry ([CLx] included) and basic four operations. I'd reluctantly agree with reciprocal because 1 [x<>y] [÷] can do the same. I'm also not sure if some programming tools should apply as well ([x=0?], [GTO], [LBL], etc), because all HP RPN programmables have the basic of them and the article/paper refers to RPN programmers, right?.

I'm adding these lines here because it seems to me that the classification makes sense when the same tools are available to everyone. Also, as you mention that there was an article about this, the scale from 10 to 15 probably has a definition on how each solution fits in the scale.

Is it possible that this article was based on some discussion groups? If you have another clue about where could this article be, I'm also interested on reading it.

Wish I could help more...


Luiz (Brazil)

Edited: 28 May 2005, 11:53 p.m.


Olá Luiz,

Eu já listei os links para o artigo que o Tizedes Csaba estava procurando. Tenho quase certeza que são esses. Trata-se de um artigo que saiu em 1978 no PPC Journal. É uma brincadeira a respeito dos diversos estilos de programação de acordo com a profissão do programador (matemático, agrimensor, engenheiro, etc...). Não concordo muito, nem você deve concordar, com o estilo de programação que, segundo o autor do artigo, teria o engenheiro. Afinal, foram engenheiros os responsáveis pela primeira calculadora científica (HP-35), tanto o hardware como o software (em apenas 768 byte de ROM). Engenheiros são conhecidos por fazer o máximo com o mínimo de recursos disponíveis, você não acha?



PS: Você ainda não me disse se testou meu último programa para funções trigonométricas (veja como é rápido!). (Eu acho que vou te mandar uma 12C com o programa na memória junto com um exemplar do seu livro para você me devolver autografado :-)



(1234 para remover)


Though this message is intended for Luiz, I know it is not polite to leave a foreign language message this long in an English language Forum. As I was not in the mood to translate it, I submitted to Babel Fish translator. See what a mess:

"Olá Luiz, I already listed links for the article that the Tizedes Csaba was looking for. I have certainty that almost they are these. One is about an article that left in 1978 in the PPC Journal. The profession of the programmer is a trick regarding the diverse styles of programming in accordance with (mathematician, surveyor, engineer, etc...). I do not agree very, nor you must agree, with the programming style that, according to article author, would have the engineer. After all, the responsible ones for the first scientific calculator had been engineers (HP-35), as much the hardware as software (in only 768 ROM byte). Engineers are known by making the maximum with the minimum of available resources, you do not find?"

This is what I meant:

"Hi Luiz,

I have already provided the links for the article Tizedes Csaba was looking for. I am almost sure they are those. It is about an 1978 PPC Journal article. It is a kidding about the various programming styles according to the programmers profession (mathematician, surveyor, engineer, etc...). I don't quite agree, neither might you, with the engineer's programming style, accorting to the author of the article. After all, engineers were responsible for the first scientific calculator ever (HP-35), to hardware and software (in only 768 bytes of ROM). Engineers are known for their ability to get the most from the least available resources, don't you think so?"

Not so perfect but better than Babel Fish :-)

Edited: 29 May 2005, 12:51 p.m.


Hi Gerson, folks;

thanks for the answer. I must confess I read your answer to Tizedes Csaba and (wrongly) thought that the links pointed to possible solutions instead of the original categorized programmers article. My mistake... sorry! And based on what you wrote, I'd certainly doubt about engineers programs category; as a matter of fact, if we look closer, engineers should reduce cost and enhance production as well as quality. So we, engineers, are 'built' to be efficient and to increase efficiency. Maybe the message has been misunderstood in the past years, because the last part (quality) has been associated to the first one (cost), not to the mid one...

Now for the politeness: I completely agree with you when you mention the English writing in here. Although it's a 'public place', it would be a complete mess if each contributor decides to write in his own language; as I've been seeing since 2001 when I met the MoHPC forum, it is hard to see messages not written in English. I saw a few in other languages I could not understand, but in this particular case, I just felt sad not knowing those lnaguages, I wish I could (I'll lean as many languages I can). Using translators is not an answer, as you shown it well.

About the program: I forgot to mention that I have already loaded it and ran, and it is definitely fast, congrats! And when you mention the fact that the program is not efficient because it needs some constants to be loaded, it depends on how you consider this efficiency. The HP12C has limited memory resources mainly because it has all of the HP38C resources and memory plus bond and depreciation. So, it is actually an old design. And if you have a look at many examples found in the HP15C Advanced Functions Handbook, you'll see some programs that use the same technique you used, but they've been written to the HP15C, with about three times more memory. Hence, I consider your program efficient as well!

About the book: I wrote one in 1995 ('Da HP41 para a HP48', Portuguese only, english translation of the title would be: "From the HP41 to the HP48") and had been a co-autor in another one (HP12C Platinum Solutions Handbook; thanks, G.W.) in 2004. Which one are you talking about? (Oh, yes, BTW: if you send me both the HP12C and the book, do you want me to send back the signed book only or should I send the HP12C with your program back to you, too? d8^D Just kidding...)

Best regards.

Luiz (BraSil)

Edited: 29 May 2005, 2:41 p.m.


Hi Luiz,

Thanks for your reply.

Seeing how easily you write long postings, it is not hard to guess it is not difficult for you to write books. (If you go on like this, you'll be nominated to ABL - Ivo Pitanguy wrote half a dozen technical books about plastic surgery and now he is there... :-). Alas, I have not discipline enough to write a book; anyway, I cannot think of any unexplored field I could contribute to.

I have "HP12C Platinum Solutions Handbook" in .pdf format. I still have to buy your other book. A friend of mine has a copy of it. BTW, when I told him I knew the author, he remarked "this guy do know HP calc programming". Since you had the trouble to key in my program, I won't have to send one 12C to you... :-)

As of foreign languages, I'd like to know a few more. Currently I have Italian classes every Saturday morning at Istituto Dante Alighieri (quarto livello). The French I had at basic school is enough to "comprendre quelques choses", but has to be improved to be useful (too bad they don't teach French at school anymore). Languages I'd like to know: French, Spanish, Russian or Polish, Hebrew or Arabian, and - it there was some time left - Latin and Greek. Luckily English is the universal language today. Not that English is an easy language, but certainly it is easier than Latin. Imagine this forum in Latin... :-)

You may have noticed sometimes I leave the note "1234 to remove" when the posting contains some personal information that is not of general interest. When this happens, most of times I delete it later. (Why "1234"? I haven't told you yet, but I am a military man - F. A. B. - so for me counting from 1 to 4 is very easy, even backwards! :-)



(1234 to remove)


Hi Gerson, guys;

Having completed the TTF files for (HP) calculators, I am 'rebuilding' the book with the new fonts. And as soon as it is concluded, I'll let it available to download and give a sign about this. I'm also working on an English version.

Best regards and thanks for the kind words ;^)

Luiz (Brazil)

Possibly Related Threads…
Thread Author Replies Views Last Post
  "HexZombie - a tool for real programmers" Thomas Chrapkiewicz 8 2,893 11-16-2013, 12:46 AM
Last Post: Kiyoshi Akima
  Question to TI-58/59 Programmers Namir 12 3,581 08-09-2012, 10:15 PM
Last Post: Luiz C. Vieira (Brazil)
  amusement for the advanced programmers of ya' Dave the "lostrabbit" 0 656 07-18-2002, 12:22 AM
Last Post: Dave the "lostrabbit"
  42S Programmers Reference John Blue 3 1,322 03-29-1999, 12:12 PM
Last Post: John Blue

Forum Jump: