Post Reply 
(41C) Quotient and Remainder
04-05-2023, 01:08 PM (This post was last modified: 04-05-2023 01:08 PM by Werner.)
Post: #3
RE: (41C) Quotient and Remainder
Hi Joe!
I have been working on these routines for quite a long time; it is surprisingly hard to get right.
see my conversation with Albert here.
And the PPC ROM routine works as long as Y is not too large wrt to R. If R is small then Y-R cannot be calculated eg
Y=2e10
X=3
result: Q=6 666 666 666, R=2
the PPC ROM will return Q=6 666 666 667 here, as it does Q=(Y-R)/X, but in 10-digit arithmetic Y-R=Y

Unfortunately, if you want to use this in a 'long division' routine, you're going to have to do an RQ split of
Y=Cc00
X=Xx
where each letter is a half-length integer and Cc < Xx, and this situation will occur, as in my last example. So I had to get it right for all those cases as well.
I also tried to return results as quickly as possible, since the halfway cases are rare (this is more prominent in the 42S routine), and use only the stack AND return X in LASTX.

Cheers, Werner

41CV†,42S,48GX,49G,DM42,DM41X,17BII,15CE,DM15L,12C,16CE
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(41C) Quotient and Remainder - Werner - 04-05-2023, 09:12 AM
RE: (41C) Quotient and Remainder - Werner - 04-05-2023 01:08 PM
RE: (41C) Quotient and Remainder - Werner - 04-10-2023, 07:25 AM
RE: (41C) Quotient and Remainder - Werner - 04-18-2023, 02:57 PM



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