Post Reply 
(42, all flavours) Integer Division - how?
12-13-2020, 01:18 PM
Post: #14
RE: (42, all flavours) Integer Division - how?
(12-13-2020 01:24 AM)Albert Chan Wrote:  return q + r

We had assumed q never overflow, which results in |r| ≤ 1

However, if q already overflowed, calculated r is basically garbage.

We should return q + sign(r), to limit the damage.
In other words, if q overflow calculator precision, don't correct the quotient.
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-13-2020 01:18 PM



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