Is there a formula for overflow?

Siarhei Siamashka siarhei.siamashka at gmail.com
Wed Nov 30 03:29:00 UTC 2022


On Wednesday, 30 November 2022 at 03:19:49 UTC, Basile B. wrote:
> writeln((3000000000LU + 3000000000LU) % uint.max);

It's actually

     writeln((3000000000LU + 3000000000LU) % (uint.max.to!ulong + 
1));

or

     writeln((3000000000LU + 3000000000LU) & uint.max);



More information about the Digitalmars-d-learn mailing list