Appearance
Round2
Declaration
Function Round2( aValue : Extended; aDigit : integer) : Extended
Example
pascal
procedure OnMapEvent(var Value:Variant);
begin
Value := Round2(123.455,2) //result is 123.45
end;Description
Returns aValue rounded to the number of decimal places given by aDigit. This function performs unbiased rounding (traditional rounding). 1-5 is rounded down, 6-9 is rounded up.
Refer to Round2Up for a function that rounds 5 up instead of down. Refer to Round2BR for a function that uses biased rounding (bankers rounding).
Examples of rounding ...
Round2(123.454,2) = 123.45
Round2(123.455,2) = 123.45
Round2(123.456,2) = 123.46
Round2(123.4545,3) = 123.454