j.logsdon@lancaster.ac.uk wrote:
Maybe I am using a slightly old version (2.95.2 19991024 (release)) but the following little program indicates there is something awry with the upper limits of cardinals.
At least cardinal(32) and cardinal(64) should be able to calculate up to 4294967296 and 18446744073709551616 respectively. Note if I try and assign these directly within the program, the program doesn't compile with errors:
constant out of range
for the 32 bit case and
value does not fit in longest integer type
for the 64 bit case.
Well, the ranges are 0 .. 2^n-1, so these numbers are just a little too big.
Cardinals limited by fewer bits (eg 20 and 24 but non-boundary anyway) should give 0 or overflow but in fact they all return 2^n in the calculations, even there n is greater than the nominal maximum but I have not used a packed variable.
Yes, they should overflow. Since GPC doesn't support range/overflow checking yet, the result is more or less undefined. Sorry...
Frank