Floor(Value: Double; Precision: Double): Double;
Value. Rounded real number.
Precision. The multiple, up to which the value must be rounded.
The Floor method rounds down the number to the nearest number, which is a multiple of precision.
Parameter values cannot be empty.
If the number and precision are positive, the value is rounded down, if the number and precision are negative, the value is rounded up. If a number is negative and precision is positive, the value is rounded down.
To execute the example, add a link to the MathFin system assembly.
Sub UserProc;
Var
r1, r2, r3: Double;
Begin
r1 := Math.Floor(3.7,2);
Debug.WriteLine(r1);
r2 := Math.Floor(-2.5,-2);
Debug.WriteLine(r2);
r3 := Math.Floor(-2.5,2);
Debug.WriteLine(r3);
End Sub UserProc;
After executing the example the console window displays rounding results:
Number and precision are positive: 2.
Number and precision are negative: -2.
Number is negative and precision is positive: -4.
See also: