[fpc-devel] Overflow checks and Trunc/Round functions

2009-06-13 Thread Alexander Klenin
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

Re: [fpc-devel] Overflow checks and Trunc/Round functions

2009-06-13 Thread Florian Klaempfl
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 :=

Re: [fpc-devel] Overflow checks and Trunc/Round functions

2009-06-13 Thread Jonas Maebe
On 13 Jun 2009, at 13:31, Alexander Klenin wrote: 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);

Re: [fpc-devel] Overflow checks and Trunc/Round functions

2009-06-13 Thread Alexander Klenin
On Sat, Jun 13, 2009 at 22:47, Jonas Maebejonas.ma...@elis.ugent.be wrote: On 13 Jun 2009, at 13:31, Alexander Klenin wrote: Currently, Round and Trunc functions ignore the state of $OVERFLOWCHECKS compiler directive. The following code prints -2 -2: In Borland-speak, these are not overflow

Re: [fpc-devel] Overflow checks and Trunc/Round functions

2009-06-13 Thread Jonas Maebe
On 13 Jun 2009, at 14:27, Alexander Klenin wrote: On Sat, Jun 13, 2009 at 22:47, Jonas Maebejonas.ma...@elis.ugent.be wrote: The difference between range and overflow errors is as follows: * range errors occur when an implicit type conversion occurs from one type to another (e.g., when