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

From Apache OpenOffice Wiki
Jump to: navigation, search
m
m
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
+
{{DISPLAYTITLE:TRUNC function}}
 +
{{Documentation/CalcFunc MathematicalTOC
 +
|ShowPrevNext=block
 +
|PrevPage=Documentation/How_Tos/Calc:_ATANH_function
 +
|NextPage=Documentation/How_Tos/Calc:_ROUND_function
 +
}}__NOTOC__
  
 
== TRUNC ==
 
== TRUNC ==
Line 17: Line 22:
 
: returns <tt>'''-1.234'''</tt>. All the <tt>'''9'''</tt>s are lost.
 
: returns <tt>'''-1.234'''</tt>. All the <tt>'''9'''</tt>s are lost.
  
If these examples do not seem to work, see '''Tools - Options - OpenOffice.org Calc - Calculate''' to check the display precision.  
+
If these examples do not seem to work, see {{menu|Tools|Options|OpenOffice Calc|Calculate}} to check the display precision.  
  
{{Documentation/SeeAlso|
+
{{SeeAlso|EN|
 
* [[Documentation/How_Tos/Calc: INT function|INT]]
 
* [[Documentation/How_Tos/Calc: INT function|INT]]
 
* [[Documentation/How_Tos/Calc: ROUND function|ROUND]]
 
* [[Documentation/How_Tos/Calc: ROUND function|ROUND]]

Latest revision as of 14:35, 31 January 2024

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 Calc → Calculate to check the display precision.



See Also
Retrieved from "https://wiki.openoffice.org/w/index.php?title=Documentation/How_Tos/Calc:_TRUNC_function&oldid=259858"
Views
Personal tools
Navigation
Tools
In other languages