Home : TRUNC
Q11611 - INFO: TRUNC

TRUNC (Primitive Spread Function) removes the specified fractional part of the specified number.

SYNTAX:

TRUNC(number,digits)

REMARKS:

Use the number argument as the number you want to truncate. Set the digits argument to the number indicating the precision of the truncation. If you do not specify a value for the digits argument, the function assumes 0.

Set digits to a value greater than zero to truncate to the specified number of decimal places. Set digits to zero to truncate to the nearest whole number. Set digits to a value less than zero to round the value left of the decimal to the nearest ten, hundred, etc.

The TRUNC and INT functions are similar in that both can return integers. Use the TRUNC function to remove the decimal portion of the number; the TRUNC function does not round up or down. Use the INT function to round numbers down to the nearest integer based decimal portion of the number.

The INT and TRUNC functions differ also when using negative numbers: TRUNC(-4.2, 0) returns –4, but INT(-4.2) returns –5 because –5 is the lower number.

Note: The setting of the TypeCurrencyDecPlaces, TypeNumberDecPlaces, and TypePercentDecPlaces properties can affect the display of the truncated number. Be sure to set the properties such that the entire number can be displayed, if that is your intended effect.  

EXAMPLES:

TRUNC(5.745)=5
TRUNC(-5.745)=-5
TRUNC(5.745,2)=5.74
TRUNC(PI())=3

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 8/28/2008 3:21 PM.
Last Modified on 8/28/2008 3:21 PM.
Last Modified by No Author Name Available!.
Article has been viewed 4199 times.
Rated 0 out of 10 based on 0 votes.
Print Article
Email Article