Topic: Rounding to the Nearest Whole Number
Hello,
I need round up to number without fractions, I create this script but I believe there is much butter way to rounding up numbers.
Anyone will be welcome to optimize the script (the Project in Attachment)
Var
Correction : Real;
procedure Form1_Button1_OnClick (Sender: TObject; var Cancel: boolean);
begin
Correction := Form1.Edit1.Value - Trunc(Form1.Edit1.Value); // Find fraction value
If (Correction < 0.5) And (Correction <> 0) Then Correction := 0.5 Else Correction := 0;
Form1.Edit2.Value := Round(Form1.Edit1.Value + Correction);
end;One can learn and graduate or stay behind.