FloorD(Value: Decimal; Precision: Decimal): Decimal;
FloorD(Value: decimal; Precision: decimal): decimal;
Value. Rounded decimal high-precision number.
Precision. A high-precision multiple, to which it is required to round.
The FloorD method returns the result of rounding down to the nearest high-precision number that is the multiple of precision.
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 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:Decimal;
Begin
r1:= math.FloorD(3.726541233655125542365854m,2m);
Debug.WriteLine(r1);
r2:= math.FloorD(-2.5m,-2.365481235841654m);
Debug.WriteLine(r2);
r3:= math.FloorD(-2.55634576215697545m,2.54m);
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.365481235841654.
Number is negative and precision is positive: -5.08.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.MathFin;
…
Public Shared Sub Main(Params: StartParams);
Var
r1, r2, r3: decimal;
Math: MathClass = New MathClass();
Begin
r1 := Math.FloorD(3.726541233655125542365854m,2m);
System.Diagnostics.Debug.WriteLine(r1);
r2 := Math.FloorD(-2.5m,-2.365481235841654m);
System.Diagnostics.Debug.WriteLine(r2);
r3 := Math.FloorD(-2.55634576215697545m,2.54m);
System.Diagnostics.Debug.WriteLine(r3);
End Sub;
See also: