HP Forums
HP33s: Quotient & Remainder - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: HP33s: Quotient & Remainder (/thread-19851.html)



HP33s: Quotient & Remainder - Gerald H - 04-25-2023 01:02 PM

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



RE: HP33s: Quotient & Remainder - Didier Lachieze - 04-29-2023 09:15 PM

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



RE: HP33s: Quotient & Remainder - Gerald H - 04-30-2023 03:58 AM

Yes, programme gives correct answers on real 33s, Bravo Didier!

LN= 30 CK= 4CF7


RE: HP33s: Quotient & Remainder - J-F Garnier - 05-01-2023 09:20 AM

(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


RE: HP33s: Quotient & Remainder - Joe Horn - 05-01-2023 03:53 PM

(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.


RE: HP33s: Quotient & Remainder - Gerald H - 05-02-2023 08:19 AM

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.