var
temp:Real;
begin
temp:=12.455345452453453452;
temp:=RoundTo(Temp,-2);
Edit1.Text := FloatToStr(Temp);//12.46
Unit
Math
Category
Arithmetic routines
type TRoundToRange = -37..37;
function RoundTo(const AValue: Double
const ADigit: TRoundToRange): Double;
Description
Call RoundTo to round AValue to a specified power of ten.
AValue is the value to round.
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:
Expression Value
RoundTo(1234567, 3) 1234000
RoundTo(1.234, -2) 1.23
RoundTo(1.235, -2) 1.24
RoundTo(1.245, -2) 1.24
Note: The behavior of RoundTo can be affected by the Set8087CW procedure or SetRoundMode function