[fpc-devel] Overflow checks and Trunc/Round functions
Alexander Klenin
klenin at gmail.com
Sat Jun 13 13:31:42 CEST 2009
Currently, Round and Trunc functions ignore the state of $OVERFLOWCHECKS
compiler directive. The following code prints "-2 -2":
{$MODE OBJFPC}{$OVERFLOWCHECKS ON}
var
a: Integer;
b: Double;
begin
b := MaxInt;
a := Round(2.0 * b);
Writeln(a);
a := Trunc(2.0 * b);
Writeln(a);
end.
This is Delphi-compatible.
However, I think this is a bug, even if Delphi-inherited, and should
be fixed in fpc/objfpc mode.
What do others think?
--
Alexander S. Klenin
More information about the fpc-devel
mailing list