On Monday, 23 September 2024 at 19:52:02 UTC, Craig Dillabaugh wrote:
Why does the following program:

    \<code>
        import std.stdio;

        int main(string[] args) {
            uint Q = 7681;
            writeln("Val = ", -1 % Q);
            return 0;
        }
    \</code>

    Print
        Val = 5568


Was hoping for 1.

I assume it is an integer promotion issue, but I am unsure how to resolve. I tried replacing the Q with to!int(Q) but this gave me -1, which is closer but not right either.

Opps, sorry.  I was expecting 7680 (not -1 or 5568).

Reply via email to