HP Forums

Full Version: HP-48SX MOD issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was transferring a program from the HP-28S to the HP-48SX and found the following issue. On the HP-28S 'MOD(5,2)' ->NUM results in the expected answer of 1. On the HP-48SX 'MOD(5,2)' can't be entered. It appears the HP-48SX won't allow MOD to appear in an algebraic expression. Others like 'MAX(5,2)' EVAL or 'PERM(5,2)' EVAL work as expected on the HP-48SX. I read about MOD in the HP-48 Programmer's Reference Manual and found nothing related there. Is this a defect or am I misunderstanding something?
Hi,

On the HP28S, the vast majority of instructions can be used in direct stack as well as in algebraic expressions.
In subsequent algebraic expressions, quite all statement syntaxes use the exact same rule: statements are all typed in a prefix style such as your example 'MOD(A,B)' or 'SIN(30) or 'IFTE( C>0,A* B/C,A+B)' etc.
The notable exceptions are logic operators OR AND and XOR. Try to enter 'OR(A,B)' on an HP-28S and you get a surprise.

On newer RPL systems, depending on the nature of the function or statement, different syntaxes are used. In particular, the modulo expression must be entered as the infix notation 'A MOD B'.

If you try 'A MOD B' on the HP-28S you get an error.
Similarly, 'MOD(A,B)' may not be valid on the HP-48SX.
> the modulo expression must be entered as the infix notation 'A MOD B'

Thanks C.Ret. I didn't know that and indeed '5 MOD 2' EVAL does work as expected on the HP-48SX. I also just noticed the HP 48 Programmer's Reference Manual says "x y -> max(x, y)" but "x y -> x mod y". So there is a clue as to the difference that I missed.
Yes, both the "HP 48 Programmer's Reference Manual" (for the 48S series) and the "HP 48G Series Advanced User's Reference Manual" incorrectly describe the symbolic MOD operation as:
x 'symb' --> 'MOD(x,symb)'
It should be
x 'symb' --> 'x MOD symb'

The remark in each operation description also uses the mod(x,y) notation instead of x mod y.
This clearly comes from the 28S.

There is a similar source of confusion in the HP BASIC, for instance the series 80 machines use the X MOD Y syntax, but the HP-75 and HP-71B use MOD(X,Y).

J-F
Reference URL's