Delphi tips : |
Incorrect rounding with Delphi? |
Delphi's Round function behaves in an unexpected way:
This means: function RoundCorrect(R: Real): LongInt; begin Result:= Trunc(R); // extract the integer part if Frac(R) >= 0.5 then // if fractional part >= 0.5 then... Result := Result + 1; // ...add 1 end; |
TOP DelphiLand Club Membership DC Library Forum Forum Archives Crash Course Delphi Tips Source Code Downloads Links
© Copyright 1999-2018
Studiebureau Festraets