Michiel Helvensteijn wrote:

> Walter, surely this test shouldn't take more than a minute for you (or
> anyone else with a D compiler installed).

Ok, ok. I'll do it. Here's the results:

----------------------------------
import std.stdio;

int main() {
        writefln(8/3);
        writefln(8/(-3));
        writefln((-8)/3);
        writefln((-8)/(-3));
        writefln(8%3);
        writefln(8%(-3));
        writefln((-8)%3);
        writefln((-8)%(-3));

        return 0;
}
----------------------------------

outputs the following

----------
2
-2
-2
2
2
2
-2
-2
----------

So DMD uses truncated division. The quotient rounds towards zero and the
remainder has the same sign as the dividend. I've updated issue 3165 with
this information.

Hope that helps.

-- 
Michiel Helvensteijn

Reply via email to