[fpc-devel]Converting between Comp and (U)Int64 types

Thomas Schatzl tom_at_work at yline.com
Fri May 18 14:11:19 CEST 2001


Hello developers !

    if you convert a comp >= 2^31 to an (U)Int64 using round() (required
because they're for any reason not assignment compatible) programs crash
with an FPU exception.
If you use trunc() instead the value is cut to 2^31.

Is there any way to overcome this and make conversions between these types
possible ?

Regards,
    Thomas

Here's a short test program:

var
    c: comp;
    b : int64;
begin
    c := 2200000000; // don't know if this is possible; just generate a
value > 2^31 somehow
    b := round(c); // or try trunc() too
end.

Using FPC 1.1 from 20.04.2001. I was told that the same happens with 1.0.4.





More information about the fpc-devel mailing list