HP Forums
HP48 program improvement. . . - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: HP48 program improvement. . . (/thread-14453.html)



HP48 program improvement. . . - tal - 01-21-2002

Hi, HP48 users!

I have a remote control program that includes a
lot of questions in this type of form:

j 6 == i 1 == AND IF THEN 7 'k' STO END
j 12 == i 23 == AND IF THEN 8 'k' STO END
j 17 == i 45 == AND IF THEN 9 'k' STO END
j 56 == i 67 == AND IF THEN 10 'k' STO END
j 34 == i 89 == AND IF THEN 11 'k' STO END
j 37 == i 111 == AND IF THEN 12 'k' STO END
.
.
.
.

I would appreciate it if you could convert these
questions so they will operate faster.

Best regards,
Tal




Re: HP48 program improvement. . . - Vieira, Luiz C. (Brazil) - 01-21-2002

Hello;

It seems, in a first look, a CASE...THEN... END structure would fit better. If you have problems implementing, send me an e-mail.

Cheers.


Re: HP48 program improvement. . . - Joe Panico - 01-23-2002

Tal,

Assuming the local variables i and j are set elsewhere, the following code works. The original code has no default value or action if an i & j pair is not found, or if neither value is not within the tested values.

{ 7 8 9 10 11 12 }
{ 6 12 17 56 34 37 } j POS
{ 1 23 45 67 89 111 } i POS
OVER == OVER 0 /= AND
IF
THEN GET
ELSE DROP@
END

This simplifies the code, I'm not sure about the speed. The =/ above is the HP48 not equal test.

Joe