[fpc-pascal] Why the difference in the rounded results?

2021-10-15 Thread Gabor Boros via fpc-pascal
Hi All, I got different results with 32bit vs. 64bit, 3.2.2 vs. 3.3.1, FPC vs. Delphi. Why? var d1,d2:Double; begin d1:=20.5; d2:=1.05; Writeln(RoundTo(d1*d2,-2)); Writeln(SimpleRoundTo(d1*d2)); d1:=28.9; Writeln; Writeln(RoundTo(d1*d2,-2)); Writeln(SimpleRoundTo(d1*d2));

[fpc-pascal] TEnumerator - After the last element?

2021-10-07 Thread Gabor Boros via fpc-pascal
Hi All, I need to know the current position is after the last element. The attached solution demonstrate what I want. Is an internal solution exists for this task? I not found anything. Gabor uses SysUtils, Generics.Collections; type TR=record i:Integer; end; TLEnumerator=class(sp

[fpc-pascal] Operators for a class

2020-12-31 Thread Gabor Boros via fpc-pascal
Hi All, I try to convert some C++ source to FPC, see below a short example from it. How can I define same operator with FPC trunk? class Cla { INT64 Num; public: Cla operator +(const Cla& m) { Cla ret(this); ret.Num += m.Num; return ret; } Gabor _