[fpc-pascal]Longer than longint?

gj bart bronco at olagrande.net
Sat Mar 2 21:55:38 CET 2002




On Sat, 2 Mar 2002, Tom Verhoeff wrote:

> >>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
>


     Yes, I'm getting an "ordinal expression expected" error (using
freepascal under dev-pas, I'm told) for an inc(variable) expression using
the comp type.  so it looks as if the compiler actually regards these as
reals.

gj






More information about the fpc-pascal mailing list