Post Reply 
(42, all flavours) Integer Division - how?
12-20-2020, 11:06 AM
Post: #50
RE: (42, all flavours) Integer Division - how?
(12-20-2020 10:09 AM)Werner Wrote:  - shouldn't that be if r== b instead of if r==0 ?

Yes. I made a typo, and will correct it. Thanks.
For testing halfway, a%b == b/2, or (a%b)*2 == b

Quote:- and, a%b*2 may overflow again?

I assume "overflow" meant lost of precision ?

This is one nice thing about binary math, *2 or /2, we do not lose precision.
Scaling just update the exponent, similar to *10 or /10 for decimal system.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (42, all flavours) Integer Division - how? - Albert Chan - 12-20-2020 11:06 AM



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