Difference between revisions of "Documentation/How Tos/Calc: TRUNC function"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Robot: Automated text replacement %s)
m (Robot: Automated text replacement %s)
Line 23: Line 23:
 
* [[Documentation/How_Tos/Calc: ROUND function|ROUND]]
 
* [[Documentation/How_Tos/Calc: ROUND function|ROUND]]
 
* [[Documentation/How_Tos/Calc: ROUNDDOWN function|ROUNDDOWN]]
 
* [[Documentation/How_Tos/Calc: ROUNDDOWN function|ROUNDDOWN]]
* [[Documentation/How_Tos/Calc: ROUNDUP function|ROUNDUP]]'''
+
* [[Documentation/How_Tos/Calc: ROUNDUP function|ROUNDUP]]
  
 
* [[Documentation/How_Tos/Calc: CEILING function|CEILING]]
 
* [[Documentation/How_Tos/Calc: CEILING function|CEILING]]
Line 29: Line 29:
 
* [[Documentation/How_Tos/Calc: EVEN function|EVEN]]
 
* [[Documentation/How_Tos/Calc: EVEN function|EVEN]]
 
* [[Documentation/How_Tos/Calc: ODD function|ODD]]
 
* [[Documentation/How_Tos/Calc: ODD function|ODD]]
* [[Documentation/How_Tos/Calc: MROUND function|MROUND]]'''
+
* [[Documentation/How_Tos/Calc: MROUND function|MROUND]]
  
* [[Documentation/How_Tos/Calc: Mathematical functions|Mathematical functions]]'''
+
* [[Documentation/How_Tos/Calc: Mathematical functions|Mathematical functions]]
  
 
* [[Documentation/How_Tos/Calc: Functions listed alphabetically|Functions listed alphabetically]]
 
* [[Documentation/How_Tos/Calc: Functions listed alphabetically|Functions listed alphabetically]]
 
* [[Documentation/How_Tos/Calc: Functions listed by category|Functions listed by category]]}}
 
* [[Documentation/How_Tos/Calc: Functions listed by category|Functions listed by category]]}}

Revision as of 14:45, 26 February 2009


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.

Template:Documentation/SeeAlso

Personal tools