IMath.Trunc

Fore Syntax

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

Fore.NET Syntax

Trunc(Value: double; Precision: integer): double;

Parameters

Value. Truncated number.

Precision. The number of decimal places that determines truncate precision.

Description

The Trunc method truncates variable points to selected number of decimal places.

Comments

Values of input parameters cannot be empty.

When the value is positive, the fractional part is truncated; when the value is negative, integer part is truncated, when the value is "0", the number is truncated to an integer.

Fore Example

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

Sub UserProc;
Var
    r: Double;
Begin
    r := Math.Trunc(8.5461263451,2);
    Debug.WriteLine(r);
End Sub UserProc;

After executing the example the console window displays the truncate result equal to -8.54.

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
    r: Double;
    Math: MathClass = New MathClass();
Begin
    r := Math.Trunc(8.5461263451,2);
    System.Diagnostics.Debug.WriteLine(r);
End Sub;

See also:

IMath | IMath.Int