Round2Up
Similar to Round2, the function Round2Up performs biased rounding and returns aValue rounded to the number of decimal places specified by aDigit.
However, this function rounds 1-4 down, and 5-9 is always rounded up.
Where aDigit is 0, the function applies the same rules but just returns the integer –
Round2Up(4.2,0) is 4.
Round2Up(4.5,0) is 5.
Round2Up(4.8,0) is 5.
Unique to Statelake, Round2Up is the most commonly used rounding function.
Also refer to Round, Round2, and RoundBR.
Declaration: Function Round2Up( aValue : Extended; aDigit : integer) : Extended
Examples follow.
Procedure
OnMapEvent(
var
Value:variant);
begin
Value := Round2Up(
123.454
,
2
);
// result is 123.45
Value := Round2Up(
123.455
,
2
);
// result is 123.46
Value := Round2Up(
123.465
,
2
);
// result is 123.47
Value := Round2Up(
123.4558
,
3
);
// result is 123.456
Value := Round2Up(
123.4553
,
3
);
// result is 123.455
Value := Round2Up(
745.554
,
2
);
// result is 745.55
Value := Round2Up(
745.555
,
2
);
// result is 745.56
Value := Round2Up(
80.374
,
2
);
// result is 80.37
Value := Round2Up(
80.4566
,
3
);
// result is 80.46
Value := Round2Up(
80.5553
,
3
);
// result is 80.56
end
;