On Friday, 24 June 2016 at 20:43:38 UTC, deadalnix wrote:

Most reasonable is

numerator = quotient * divisor + remainder

Which means it can be negative.

Example:

void main()
{
        int x1 = 2;
        int x2 = -2;
        uint x3 = 2;
        
        assert(-7 % x1 == -1);
        assert(-7 % x2 == -1);
        assert(-7 % x3 == -1); //fails
}


Reply via email to