Truncates a number to a specified number of digits.
Sample Usage
TRUNC(5.9)
TRUNC(-5.9)
TRUNC(C5)
Syntax
TRUNC(number, count)
- number - The number to be truncated.
- count - The number of decimal places which remain after truncation.
Examples
TRUNC(5.9) truncates the number and returns the integer part 5.
TRUNC(-5.9) truncates the number and returns the integer part 5.
Notes
- If count is greater than the number of significant digits in number, the number is returned without modification.
- count may be negative, in which case the specified number of digits to the left of the decimal place are changed to zero. All digits to the right of the decimal place are discarded.
- TRUNC performs no rounding, simply discarding unwanted digits.
- TRUNC and INT are similar in that both return integers. TRUNC removes the fractional part of the number. INT rounds numbers down to the nearest integer based on the value of the fractional part of the number. INT and TRUNC are different only when using negative numbers.