if you write "RoundTo(14.345, -2)" then the result will be
14.34, not 14.35
You might give a little offset to adjust the result:
"RoundTo(14.345 + 0.0000001, -2)" Result -> 14.35
Does anyone else know how to manage that little detail?
// Example-Prog
procedure TfMain.btnRoundClick(Sender: TObject);
const korrOffs: Double = 0.0000001;
var aDouble1, aDouble2: Double;
begin
aDouble1 := RoundTo(14.345, -2);// = 14.34
aDouble2 := RoundTo(14.345 + korrOffs, -2);//= 14.35
MessageDlg('Round_1: 14.345 -> '+ FloatToStr(aDouble1)
, mtWarning, [mbOK], 0);//->14.34
MessageDlg('Round_2: 14.345 -> '+ FloatToStr(aDouble2)
, mtWarning, [mbOK], 0);//->14.35
end;