IMath.RoundDown

Syntax

RoundDown(Value: Double; Precision: Integer): Double;

Parameters

Value. Rounded real number.

Precision. The number of decimal places, to which a number must be rounded.

Description

The RoundDown method returns the result of rounding to the nearest value, less by module.

Comments

Values of input parameters cannot be empty.

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.Round method, except that the number is always rounded down.

Example

To execute the example, add a link to the MathFin system assembly.

Sub UserProc;
Var
    r1, r2, r3, r4: Double;
Begin
    r1 := Math.RoundDown(2.15,1);
    Debug.WriteLine(r1);
    r2 := Math.RoundDown(-50.654,-2);
    Debug.WriteLine(r2);
    r3 := Math.RoundDown(21.5,-1);
    Debug.WriteLine(r3);
    r4 := Math.RoundDown(-1.475,2);
    Debug.WriteLine(r4);
End Sub UserProc;

After executing the example the console window displays rounding results:

See also:

IMath