On Monday, September 23, 2024 1:52:02 PM MDT Craig Dillabaugh via Digitalmars- d-learn 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.
Well, this is what the spec says: https://dlang.org/spec/expression.html#division - Jonathan M Davis