Oops! Currently, I don't have Linux 64bit environment. Please wait.
Comment #2 by braddr — 2011-03-27T15:23:47Z
Reduced bug, nothing to do with the random parts at all:
module bug;
extern(C) int printf(const char*, ...);
int main()
{
// neither of these produce the expected result.
ulong[] checking = [ 2_463_534_242UL ];
//long[] checking = [ 2_463_534_242L ];
printf("typeof(checking) = '%.*s'\n",
typeid(checking).toString.length,
typeid(checking).toString.ptr);
foreach (i, e; checking)
printf("i = %zd, e = %lld\n", i, e);
return 0;
}
$ dmd -m64 bug-random.d && ./bug-random
Produces:
typeof(checking) = 'ulong[]'
i = 0, e = -1831433054
using %llu (or %lu, just to make sure I wasn't crazy about the size specifier):
typeof(checking) = 'ulong[]'
i = 0, e = 18446744071878118562