Trunc(Value: Double; Precision: Integer): Double;
Trunc(Value: double; Precision: integer): double;
Value. Truncated number.
Precision. The number of decimal places that determines truncate precision.
The Trunc method truncates variable points to selected number of decimal places.
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.
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.
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: