HP Forums

Full Version: HP48 program improvement. . .
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

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

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.

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