Truncate/Trunc
Truncate is a mathematical function that removes the specified number of digits from numeric values.
Syntax:
Trunc (arg1, integer)
-
where arg1 is one of these arguments:
Table B-23 Arguments for the Truncate/Trunc Function
Argument Description numeric
A numeric value; for example, 234.567.
row, column, or cell reference
A pointer to a row, column, or cell within a grid. References can be specified in several ways. The reference syntax:
GridName.GridElement[segment(range)].property
function
An embedded function
-
where integer specifies the number of digits you want to remove:
-
A positive integer determines the number of significant digits that remain to the right of the decimal point.
-
A zero (0) integer returns the integer located to the left of the decimal point.
-
A negative integer indicates the number of significant digits that are truncated to the left of the decimal point.
-
Examples:
The following statement uses a positive integer of 2. The first two digits to the right of the decimal point remain, and the following digit is removed:
Trunc(234.567, 2) = 234.56
The following statement uses a zero (0) integer. All digits to the right of the decimal point are removed:
Trunc(234.567, 0) = 234
The following statement uses a negative integer of -2. All digits to the right of the decimal point are removed and the last two digits of the integer are truncated.
Trunc(234.567, -2) = 200
Note:
Formatting previously applied to a cell, column, or row is maintained when you use the Trunc function. The following example shows the results of a Trunc function where the cell value was previously formatted to display three decimal places: Trunc(234.567, 0) = 234.000