Post Reply 
HP-48SX MOD issue
06-04-2022, 06:41 PM
Post: #1
HP-48SX MOD issue
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?
Find all posts by this user
Quote this message in a reply
06-04-2022, 07:07 PM (This post was last modified: 06-04-2022 07:16 PM by C.Ret.)
Post: #2
RE: HP-48SX MOD issue
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.
Find all posts by this user
Quote this message in a reply
06-04-2022, 07:57 PM (This post was last modified: 06-04-2022 07:58 PM by Rick314.)
Post: #3
RE: HP-48SX MOD issue
> 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.
Find all posts by this user
Quote this message in a reply
06-04-2022, 09:00 PM
Post: #4
RE: HP-48SX MOD issue
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
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)