On Friday, 24 June 2016 at 20:33:45 UTC, Andrei Alexandrescu wrote:
In a checked environment, division may "overflow", e.g. -6 / 2u must be typed as uint but is not representable properly one.

How about remainder? I suppose one can make the argument that remainder should never overflow (save for rhs == 0), because it could be defined with either a positive or negative denominator (which is not part of the result).

What's the most reasonable behavior?


Andrei

Most reasonable is

numerator = quotient * divisor + remainder

Which means it can be negative.

Reply via email to