So I found this using 2 to the power of >= 31

Carlos checoimg at gmail.com
Wed Jun 12 18:35:41 PDT 2013


I have this code :

import std.stdio;
import std.c.stdlib;

void main()
{
foreach (count; 1 .. 33){
	write((2)^^(count), " : ", count,  "\n");
	}
exit (0);
}
And here is the output :

2 : 1
4 : 2
8 : 3
16 : 4
32 : 5
64 : 6
128 : 7
256 : 8
512 : 9
1024 : 10
2048 : 11
4096 : 12
8192 : 13
16384 : 14
32768 : 15
65536 : 16
131072 : 17
262144 : 18
524288 : 19
1048576 : 20
2097152 : 21
4194304 : 22
8388608 : 23
16777216 : 24
33554432 : 25
67108864 : 26
134217728 : 27
268435456 : 28
536870912 : 29
1073741824 : 30
-2147483648 : 31
0 : 32


-----------------------------------------------------------------------

Everything goes well until the power of 31 and then above that it 
will be cero.

What do I have to know about how D works with data ?


More information about the Digitalmars-d-learn mailing list