CeilingD(Value: Decimal; Precision: Decimal): Decimal;
CeilingD(Value: decimal; Precision: decimal): decimal;
Value. Rounded decimal high-precision number.
Precision. A high-precision multiple, to which it is required to round.
The CeilingD method rounds up the number to the nearest high-precision number, which is a 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 a number and precision are positive, the value is rounded up.
If a number and precision are negative, the value is rounded up.
If a number is negative and precision is positive, the value is rounded up.
To execute the example, add a link to the MathFin system assembly.
Sub UserProc;
Var
r1,r2,r3: Decimal;
Begin
r1 := Math.CeilingD(1.554951234587512484m,0.1m);
Debug.WriteLine(r1);
r2 := Math.CeilingD(-2.5m,-2.365481235841654m);
Debug.WriteLine(r2);
r3 := Math.CeilingD(-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: 1.6.
Number and precision are negative: -4.730962471683308.
Number is negative and precision is positive: -2.54.
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.CeilingD(1.554951234587512484m,0.1m);
System.Diagnostics.Debug.WriteLine(r1);
r2 := Math.CeilingD(-2.5m,-2.365481235841654m);
System.Diagnostics.Debug.WriteLine(r2);
r3 := Math.CeilingD(-2.55634576215697545m,2.54m);
System.Diagnostics.Debug.WriteLine(r3);
End Sub;
See also: