Alexander Klenin schrieb:
> 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?
> 

Which arithemtic operation overflows? Fill a bug report, if you no range
check error is thrown.
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to