55 lines
3.6 KiB
XML
55 lines
3.6 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<helpdocument version="1.0">
|
|
<!--
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
-->
|
|
|
|
<meta>
|
|
<topic id="trunc_function" indexer="include" status="PUBLISH">
|
|
<title id="tit" xml-lang="en-US">TRUNC function</title>
|
|
<filename>/text/scalc/01/func_trunc.xhp</filename>
|
|
</topic>
|
|
</meta>
|
|
|
|
<body>
|
|
<bookmark xml-lang="en-US" branch="index" id="bm_id3156384">
|
|
<bookmark_value>TRUNC function</bookmark_value>
|
|
<bookmark_value>decimal places;cutting off</bookmark_value>
|
|
<bookmark_value>numbers;truncate</bookmark_value>
|
|
</bookmark>
|
|
<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_KUERZEN" id="bm_id3157849" localize="false"/>
|
|
<h1 id="hd_id601641846107898"><variable id="trunc_h1"><link href="text/scalc/01/func_trunc.xhp">TRUNC function</link></variable></h1>
|
|
<section id="trunc_desc">
|
|
<paragraph role="paragraph" id="par_id841641927277474">Truncates a number while keeping a specified number of decimal digits.</paragraph>
|
|
</section>
|
|
<paragraph role="paragraph" id="par_id701642530512560">This function is equivalent to the <link href="text/scalc/01/func_rounddown.xhp">ROUNDDOWN function</link>.</paragraph>
|
|
<section id="trunc_tip">
|
|
<tip id="par_id321641927458888">The rounding method used by this function is known as <emph>rounding towards zero</emph>. The magnitude of the resulting number will always be less than or equal to the original number.</tip>
|
|
</section>
|
|
<embed href="text/scalc/01/ful_func.xhp#func_head_syntax"/>
|
|
<paragraph role="paragraph" id="par_id341641927560587">
|
|
<input>TRUNC(Number [; Count])</input>
|
|
</paragraph>
|
|
<section id="trunc_parameters">
|
|
<paragraph role="paragraph" id="par_id11641927688319"><emph>Number:</emph> The number to be truncated.</paragraph>
|
|
<paragraph role="paragraph" id="par_id861641927715672"><emph>Count:</emph> Optional parameter that defines the number of decimal places to be kept. The default value is 0 (zero).</paragraph>
|
|
<paragraph role="paragraph" id="par_id911641928545976">Use negative values for <emph>Count</emph> to round the integer part of the original <emph>Number</emph>. For example, -1 will round down the first integer number before the decimal separator, -2 will round down the two integer numbers before the decimal separator, and so forth.</paragraph>
|
|
</section>
|
|
<embed href="text/scalc/01/ful_func.xhp#func_head_example"/>
|
|
<paragraph role="paragraph" id="par_id901641928192870"><input>=TRUNC(21.89)</input> returns 21. Note that this example uses the default value for <emph>Count</emph> which is 0.</paragraph>
|
|
<paragraph role="paragraph" id="par_id901641928192110"><input>=TRUNC(103.37,1)</input> returns 103.3.</paragraph>
|
|
<paragraph role="paragraph" id="par_id171641928456743"><input>=TRUNC(0.664,2)</input> returns 0.66.</paragraph>
|
|
<paragraph role="paragraph" id="par_id641641928712287"><input>=TRUNC(214.2,-1)</input> returns 210. Note the negative value for <emph>Count</emph>, which causes the first integer value before the decimal separator to be rounded towards zero.</paragraph>
|
|
|
|
<section id="relatedtopics">
|
|
<tip id="par_id821677013765236"><link href="https://wiki.documentfoundation.org/Documentation/Calc_Functions/TRUNC">TRUNC wiki page</link>.</tip>
|
|
<embed href="text/scalc/01/func_rounddown.xhp#rounddown_h1"/>
|
|
<embed href="text/scalc/01/04060106.xhp#math_functions_h1"/>
|
|
</section>
|
|
</body>
|
|
</helpdocument>
|