RoundUp(Value: Double; Precision: Integer): Double;
Value. Rounded real number.
Precision. The number of decimal places, to which a number must be rounded.
The RoundUp method returns the number, rounded to the nearest value, greater by module.
Values of input parameters cannot be empty.
If the number of decimal places is greater than 0, the number is rounded up to the specified number of decimal places after the decimal separator.
If the number of decimal places is equal to 0, the number is rounded to the nearest integer.
If the number of decimal places is less than 0, the number is rounded up, taking into account the decimal places before the decimal separator.
The RoundUp method is similar to the IMath.Round method, except that the number is always rounded down.
To execute the example, add a link to the MathFin system assembly.
Sub UserProc;
Var
r1, r2, r3, r4: Double;
Begin
r1 := Math.RoundUp(2.154956124,1);
Debug.WriteLine(r1);
r2 := Math.RoundUp(-50.654,-2);
Debug.WriteLine(r2);
r3 := Math.RoundUp(21.5,-1);
Debug.WriteLine(r3);
r4 := Math.RoundUp(-1.475,2);
Debug.WriteLine(r4);
End Sub UserProc;
After executing the example the console window displays rounding results:
A number and the number of decimal places are positive: 2.2.
A number and the number of decimal places are negative: -100.
A number is positive and the number of decimal places is negative: 30.
A number is negative and the number of decimal places is positive: -1.48.
See also: