Use RoundTo(variable, 3)
.
The second parameter specifies the digits you want to round to. Since you want to round to 1000 = 103 you need to specifiy 3
, not 1000
.
The documentation for RoundTo
says:
function RoundTo(const AValue: Extended; const ADigit: TRoundToEXRangeExtended): Extended;
Rounds a floating-point value to a specified digit or power of ten using "Banker's rounding".
ADigit indicates the power of ten to which you want AValue rounded. It can be any value from –37 to 37 (inclusive).
The following examples illustrate the use of RoundTo:
RoundTo(1234567, 3) = 1235000
(I left out parts not relevant to your question)
Side-note: RoundTo
uses Banker's round, so RoundTo(500, 3) = 0
and RoundTo(1500, 3) = 2000
.