Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2001-05

Converting between Comp and (U)Int64 types

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Thomas Schatzl

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.