HP33s: Quotient & Remainder
04-25-2023, 01:02 PM
Post: #1
 Gerald H Senior Member Posts: 1,627 Joined: May 2014
HP33s: Quotient & Remainder
Q & R
For input of integers
Y
X
The programme returns the quotient of Y/X
Q
to the stack & stores RMDR(Y:X) in R & quotient in Q.

Does not disturb stack.

Code:
1.    LBL P 2.    STO R 3.    x<>y 4.    STO Q 5.    x<>y 6.    RMDR 7.    x<> R 8.    RCL Q 9.    RCL- R 10.    x<>y 11.    / 12.    STO Q 13.    RTN H: LN = 39
04-29-2023, 09:15 PM
Post: #2
 Didier Lachieze Senior Member Posts: 1,630 Joined: Dec 2013
RE: HP33s: Quotient & Remainder
This should also work but I don’t have a 33s to test it:

Code:
 1.    LBL P  2.    x<>y  3.    STO R  4.    x<>y  5.    RMDR  6.    x<>R  7.    Lastx  8.    INT÷  9.    STO Q 10.    RTN
04-30-2023, 03:58 AM
Post: #3
 Gerald H Senior Member Posts: 1,627 Joined: May 2014
RE: HP33s: Quotient & Remainder
Yes, programme gives correct answers on real 33s, Bravo Didier!

LN= 30 CK= 4CF7
05-01-2023, 09:20 AM
Post: #4
 J-F Garnier Senior Member Posts: 937 Joined: Dec 2013
RE: HP33s: Quotient & Remainder
(04-29-2023 09:15 PM)Didier Lachieze Wrote:  This should also work but I don’t have a 33s to test it:

Code:
 1.    LBL P  2.    x<>y  3.    STO R  4.    x<>y  5.    RMDR  6.    x<>R  7.    Lastx  8.    INT÷  9.    STO Q 10.    RTN

Running this code on my 35S:
2E12 3 XEQ P
--> Q= 666666666667 incorrect !
R= 2 correct
The culprit is the INT÷ function !
Curiously this bug is not in the 35S bug list.

Can someone confirm the 33S is correct or not for this test case?

J-F
05-01-2023, 03:53 PM
Post: #5
 Joe Horn Senior Member Posts: 2,000 Joined: Dec 2013
RE: HP33s: Quotient & Remainder
(05-01-2023 09:20 AM)J-F Garnier Wrote:  Running this code on my 35S:
2E12 3 XEQ P
--> Q= 666666666667 incorrect !
R= 2 correct
The culprit is the INT÷ function !
Curiously this bug is not in the 35S bug list.

Can someone confirm the 33S is correct or not for this test case?

J-F

The 33s also gets it wrong.

<0|ɸ|0>
-Joe-
05-02-2023, 08:19 AM (This post was last modified: 05-02-2023 08:22 AM by Gerald H.)
Post: #6
 Gerald H Senior Member Posts: 1,627 Joined: May 2014
RE: HP33s: Quotient & Remainder
While the answer is certainly wrong I don't use Q & R functions on 33s for numbers greater than (10^12)-1, for which the results are correct.

Incorrect answer also given for (2e12)+17.
 « Next Oldest | Next Newest »

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