Documentation/How Tos/Calc: TRUNC function

From Apache OpenOffice Wiki
< Documentation‎ | How Tos
Revision as of 06:30, 19 December 2007 by Drking (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


TRUNC

Truncates a number by removing decimal places.


Syntax:

TRUNC(number; places)

returns number with at most places decimal places. Excess decimal places are simply removed, irrespective of sign.
TRUNC(number; 0) behaves as INT(number) for positive numbers, but effectively rounds towards zero for negative numbers.


Example:

TRUNC(1.239; 2)

returns 1.23. The 9 is lost.

TRUNC(-1.234999; 3)

returns -1.234. All the 9s are lost.

If these examples do not seem to work, see Tools - Options - OpenOffice.org Calc - Calculate to check the display precision.


See also:

INT, ROUND, ROUNDDOWN, ROUNDUP

CEILING, FLOOR, EVEN, ODD, MROUND

Mathematical functions

Personal tools