[Issue 21151] div bug: long -5000 / size_t 2 = 9223372036854773308

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 13 07:53:05 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21151

--- Comment #6 from mw <mingwu at gmail.com> ---
OK, let me write this in this way to show it's impact:

==================================
import std.algorithm;
import std.stdio;

void main() {
  long[] a = [-5000, 0];
  long   c = sum(a) / a.length;
  writeln(c);
}
==================================


$ ./divbug
9223372036854773308

--


More information about the Digitalmars-d-bugs mailing list