IMath.RoundDUp

Fore Syntax

RoundDUp(Value: Decimal; Precision: Integer): Decimal;

Fore.NET Syntax

RoundDUp(Value: decimal; Precision: integer): decimal;

Parameters

Value. Rounded decimal high-precision number.

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

Description

The RoundDUp method returns the result of rounding of a high-precision decimal number to the nearest value, greater by module.

Comments

To define numbers of the Decimal type in the array, add the m character after each number. For example: 0.001m.

If the number of decimal places is greater than 0, the number is rounded up to the specified number of decimal places after the decimal separator.

If the number of decimal places is equal to 0, the number is rounded to the nearest integer.

If the number of decimal places is less than 0, the number is rounded up, taking into account the decimal places before the decimal separator.

The RoundDUp method is similar to the IMath.RoundD method, except that numbers are always rounded up.

Fore Example

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

Sub UserProc;
Var
    r1, r2, r3, r4: Decimal;
Begin
    r1 := Math.RoundDUp(2.154956124m,1);
    Debug.WriteLine(r1);
    r2 := Math.RoundDUp(-50.654m,-2);
    Debug.WriteLine(r2);
    r3 := Math.RoundDUp(21.5m,-1);
    Debug.WriteLine(r3);
    r4 := Math.RoundDUp(-1.475m,2);
    Debug.WriteLine(r4);
End Sub UserProc;

After executing the example the console window displays rounding results:

Fore.NET Example

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, r4: Decimal;
    Math: MathClass = New MathClass();
Begin
    r1 := Math.RoundDUp(2.154956124m,1);
    System.Diagnostics.Debug.WriteLine(r1);
    r2 := Math.RoundDUp(-50.654m,-2);
    System.Diagnostics.Debug.WriteLine(r2);
    r3 := Math.RoundDUp(21.5m,-1);
    System.Diagnostics.Debug.WriteLine(r3);
    r4 := Math.RoundDUp(-1.475m,2);
    System.Diagnostics.Debug.WriteLine(r4);
End Sub;

See also:

IMath