HP48SX MOD issue

06042022, 06:41 PM
Post: #1




HP48SX MOD issue
I was transferring a program from the HP28S to the HP48SX and found the following issue. On the HP28S 'MOD(5,2)' >NUM results in the expected answer of 1. On the HP48SX 'MOD(5,2)' can't be entered. It appears the HP48SX 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 HP48SX. I read about MOD in the HP48 Programmer's Reference Manual and found nothing related there. Is this a defect or am I misunderstanding something?


06042022, 07:07 PM
(This post was last modified: 06042022 07:16 PM by C.Ret.)
Post: #2




RE: HP48SX 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 HP28S 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 HP28S you get an error. Similarly, 'MOD(A,B)' may not be valid on the HP48SX. 

06042022, 07:57 PM
(This post was last modified: 06042022 07:58 PM by Rick314.)
Post: #3




RE: HP48SX 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 HP48SX. 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. 

06042022, 09:00 PM
Post: #4




RE: HP48SX 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 HP75 and HP71B use MOD(X,Y). JF 

« Next Oldest  Next Newest »

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