[fpc-pascal]Longer than longint?
Tom Verhoeff
wstomv at win.tue.nl
Sat Mar 2 20:46:19 CET 2002
>>Is there a formal integer data type larger than longint?
>
>You can use int64 which is a signed 64 Bit type or if you don't need
>bit operations, use the comp type.
>
>>Also, are there
>>any potential problems involving representing large integers in the
>>"extended" real format (like hidden processor rounding or whatever)?
>
>The extended type leads to no rounding errors if the numbers
>stay in the range of signed 64 bit mantissa.
However, both Int64 and Comp will NOT allow iteration with a for loop:
const c10e9 = 1000000000;
var i: Int64;
begin
for i := c10e9 to c10e9 + 9 do
writeln ( 'i = ', i )
end.
You get
Error: Ordinal expression expected (at the i in "for i := ...")
This copies the behavior of Delphi. Nevertheless, I consider it a
bug in Delphi and FPC that for loops over Int64 are rejected. The
documentation states that Int64 is an ordinal (integer) type. It
is quite natural to have for loops over this type.
Tom
More information about the fpc-pascal
mailing list