The Museum of HP Calculators

HP Forum Archive 15

[ Return to Index | Top of Index ]

Categorized programmers
Message #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 programmers
Message #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 programmers
Message #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?

http://www.holyjoe.org/hp/flash07.txt

Regards,

Gerson.

--------------------------

Here is the link to the original PPC article, see pages 31-32:

http://hp41.claughan.com/DVD/Users%20Groups/PPC/PPC%20Journal%20V5N8.pdf

---------------------------

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 toggle
Message #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 toggle
Message #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 toggle
Message #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 toggle
Message #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.

      
Re: Categorized programmers
Message #11 Posted by Vieira, Luiz C. (Brazil) on 28 May 2005, 8:57 p.m.,
in response to message #1 by Tizedes Csaba

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

Cheers.

Luiz (Brazil)

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

            
To Luiz (Was: Re: Categorized programmers)
Message #12 Posted by GWB on 29 May 2005, 11:36 a.m.,
in response to message #11 by Vieira, Luiz C. (Brazil)

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?

Até,

Gerson.

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

Até,

Gerson.

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

                  
(a bit off-topic and somehow long) Re: To Luiz (Was: Re: Categorized programmers)
Message #13 Posted by Vieira, Luiz C. (Brazil) on 29 May 2005, 1:57 p.m.,
in response to message #12 by GWB

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.

                        
Re: (completely off-topic and somewhat long) Re: To Luiz (Was: Re: Categorized programmers)
Message #14 Posted by GWB on 29 May 2005, 5:43 p.m.,
in response to message #13 by Vieira, Luiz C. (Brazil)

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

Cheers,

Gerson.

(1234 to remove)

                              
'Da HP41 para a HP48' in .pdf format soon
Message #15 Posted by Vieira, Luiz C. (Brazil) on 29 May 2005, 7:13 p.m.,
in response to message #14 by GWB

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)


[ Return to Index | Top of Index ]

Go back to the main exhibit hall