RoundDDown(Value: Decimal; Precision: Integer): Decimal;
Value. Rounded decimal high-precision number.
Precision. The number of decimal places, to which the number must be rounded.
The RoundDDown method returns the result of rounding a decimal high-precision number to the nearest value, less by module.
To define numbers of the Decimal type in the array, it is necessary to write the "m" character after the value of each number. For example: 0.001m.
If the number of decimal places is greater than 0, the number is rounded down to the specified number of decimal places after a decimal separator.
If the number of decimal places is equal to 0, the number is rounded down to the nearest integer.
If the number of decimal places is less than 0, the number is rounded down to the set number of decimal places before the decimal separator.
The RoundDDown method is similar to the IMath.RoundD 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: Decimal;
Begin
r1 := Math.RoundDDown(2.154956124m,1);
Debug.WriteLine(r1);
r2 := Math.RoundDDown(-50.654m,-2);
Debug.WriteLine(r2);
r3 := Math.RoundDDown(21.5m,-1);
Debug.WriteLine(r3);
r4 := Math.RoundDDown(-1.475m,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.1.
A number and the number of decimal places are negative: 0.
A number is positive and the number of decimal places is negative: 20
A number is negative and the number of decimal places is positive: -1.47.
See also: