Hello,

How do Visual C/C++ handle integer division of negative numbers. I am specifically thinking of the sign of the remainder.

Regards.

Even

1. a/b is the algebraic quotient with the fractional part discarded (truncation toward zero)

2. The sign of a%b is the same as that of a

See for example

http://stackoverflow.com/questions/3602827/what-is-the-behavior-of-integer-division-in-c

David Wilkinson | Visual C++ MVP