On 2012-35-28 0709, Jesse Phillips <jessekphillip...@gmail.com> wrote:
Am I getting something wrong with this code?
import std.conv;
import std.math;
void main() {
pragma(msg, "Number of bits: " ~ to!string(12 * 4));
pragma(msg, "Addressable Bytes: " ~ to!string(pow(2, 12 * 4)));
}
Number of bits: 48
Addressable Bytes: 0
Linux 64bit dmd 2.060...
Specifically, shouldn't 2^48 be a little bit larger than 0?
And if you have corrections to the math as it applies to the statements
I'm open to correction, but I expect it is correct.
Quick, how much is 2 << 47 modulo 2^^32?
At least I think that's the problem - all numbers involved are simple ints,
and so you get overflow. Try pow(2L, 12 * 4) instead.
--
Simen