summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Lima <rafael.palma.lima@gmail.com>2022-01-11 20:22:12 +0100
committerOlivier Hallot <olivier.hallot@libreoffice.org>2022-01-19 00:10:20 +0100
commit6b1075e1e032be5bb6cba1dbdcc11de2a1824add (patch)
treec10a063bb7418b7efe7bd8c3a6c1711d3be2c43e
parent8a560f1347dfcf3f181bb827845fd33d1b22eddb (diff)
tdf#145332 Improve help pages for TRUNC and ROUNDDOWN
Since TRUNC and ROUNDDOWN perform the same function, the help pages are now more consistent. The help pages were created in separate files. Change-Id: I68092c61f2cb80c66e798c188d9c4172de5d48c0 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/128244 Tested-by: Jenkins Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
-rw-r--r--AllLangHelp_scalc.mk2
-rw-r--r--source/text/scalc/01/04060106.xhp51
-rw-r--r--source/text/scalc/01/func_rounddown.xhp52
-rw-r--r--source/text/scalc/01/func_trunc.xhp54
4 files changed, 115 insertions, 44 deletions
diff --git a/AllLangHelp_scalc.mk b/AllLangHelp_scalc.mk
index 9a896f1476..9c6be8ef63 100644
--- a/AllLangHelp_scalc.mk
+++ b/AllLangHelp_scalc.mk
@@ -251,6 +251,7 @@ $(eval $(call gb_AllLangHelp_add_helpfiles,scalc,\
helpcontent2/source/text/scalc/01/func_regex \
helpcontent2/source/text/scalc/01/func_replaceb \
helpcontent2/source/text/scalc/01/func_roman \
+ helpcontent2/source/text/scalc/01/func_rounddown \
helpcontent2/source/text/scalc/01/func_roundsig \
helpcontent2/source/text/scalc/01/func_second \
helpcontent2/source/text/scalc/01/func_skewp \
@@ -262,6 +263,7 @@ $(eval $(call gb_AllLangHelp_add_helpfiles,scalc,\
helpcontent2/source/text/scalc/01/func_time \
helpcontent2/source/text/scalc/01/func_timevalue \
helpcontent2/source/text/scalc/01/func_today \
+ helpcontent2/source/text/scalc/01/func_trunc \
helpcontent2/source/text/scalc/01/func_value \
helpcontent2/source/text/scalc/01/func_weekday \
helpcontent2/source/text/scalc/01/func_webservice \
diff --git a/source/text/scalc/01/04060106.xhp b/source/text/scalc/01/04060106.xhp
index 61e0355747..e2f2d18851 100644
--- a/source/text/scalc/01/04060106.xhp
+++ b/source/text/scalc/01/04060106.xhp
@@ -35,7 +35,7 @@
</bookmark>
-<h1 id="hd_id3147124">Mathematical Functions</h1>
+<h1 id="hd_id3147124"><variable id="math_functions_h1"><link href="text/scalc/01/04060106.xhp" name="math_link">Mathematical Functions</link></variable></h1>
<paragraph id="par_id3154943" role="paragraph" xml-lang="en-US"><variable id="mathematiktext">This category contains the <emph>Mathematical</emph> functions for Calc.</variable> To open the <emph>Function Wizard</emph>, choose <link href="text/scalc/01/04060000.xhp" name="Insert - Function"><emph>Insert - Function</emph></link>.</paragraph>
<sort order="asc" descendant="h2">
<section id="Section1">
@@ -606,29 +606,9 @@
<paragraph id="par_id3152904" role="paragraph" xml-lang="en-US"><item type="input">=COMBINA(3;2)</item> returns 6.</paragraph><comment>see also COMBIN</comment>
</section>
-<section id="Section35">
-<bookmark xml-lang="en-US" branch="index" id="bm_id3156086">
- <bookmark_value>TRUNC function</bookmark_value>
- <bookmark_value>decimal places;cutting off</bookmark_value>
-</bookmark>
-<comment>mw added one entry</comment>
-<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_KUERZEN" id="bm_id3157849" localize="false"/>
-
-<h2 id="hd_id3156086">TRUNC</h2>
-<paragraph id="par_id3157866" role="paragraph" xml-lang="en-US"><ahelp hid="HID_FUNC_KUERZEN">Truncates a number by removing decimal places.</ahelp></paragraph>
-
-<embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
-<paragraph id="par_id3148511" role="code" xml-lang="en-US">TRUNC(Number[; Count])</paragraph>
-<paragraph id="par_id3150796" role="paragraph" xml-lang="en-US">Returns <emph>Number</emph> with at most <emph>Count</emph> decimal places. Excess decimal places are simply removed, irrespective of sign.</paragraph>
-<paragraph id="par_id3150816" role="paragraph" xml-lang="en-US"><item type="literal">TRUNC(Number; 0)</item> behaves as <item type="literal">INT(Number)</item> for positive numbers, but effectively rounds towards zero for negative numbers.</paragraph>
-<warning id="par_id3148548">The <emph>visible</emph> decimal places of the result are specified in <switchinline select="sys"><caseinline select="MAC">%PRODUCTNAME - Preferences
-</caseinline><defaultinline>Tools - Options</defaultinline></switchinline> - <link href="text/shared/optionen/01060500.xhp">%PRODUCTNAME Calc - Calculate</link>.</warning>
-
-<embed href="text/scalc/01/common_func.xhp#sectionexample"/>
-<paragraph id="par_id3152569" role="paragraph" xml-lang="en-US"><item type="input">=TRUNC(1.239;2)</item> returns 1.23. The 9 is lost.</paragraph>
-<paragraph id="par_id7050080" role="paragraph" xml-lang="en-US"><item type="input">=TRUNC(-1.234999;3)</item> returns -1.234. All the 9s are lost.</paragraph><comment>see also INT, ROUND, ROUNDDOWN, ROUNDUP, CEILING, FLOOR, EVEN, ODD, MROUND</comment>
-<paragraph role="paragraph" id="par_id441635243969504"><input>=TRUNC(-45.67)</input> returns -45. The default value for <emph>Count</emph> is 0.</paragraph>
-<tip id="par_id151635245092041">Refer to the <link href="https://wiki.documentfoundation.org/Documentation/Calc_Functions/TRUNC" name="TRUNC_Wiki">TRUNC</link> wiki page for more details about this function.</tip>
+<section id="trunc">
+ <h2 id="hd_id561641930400206"><link href="text/scalc/01/func_trunc.xhp" name="trunc_link">TRUNC</link></h2>
+ <embed href="text/scalc/01/func_trunc.xhp#trunc_desc"/>
</section>
<section id="Section34">
@@ -892,26 +872,9 @@
<paragraph id="par_id7868892" role="paragraph" xml-lang="en-US"><item type="input">=ROUND(987.65;-2)</item> returns 1000.</paragraph><comment>see also INT, TRUNC, ROUNDDOWN, ROUNDUP, CEILING, FLOOR, EVEN, ODD, MROUND</comment>
</section>
-<section id="Section20">
-<bookmark xml-lang="en-US" branch="index" id="bm_id3145991">
- <bookmark_value>ROUNDDOWN function</bookmark_value>
-</bookmark>
-
-<bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_ABRUNDEN" id="bm_id3146003" localize="false"/>
-
-<h2 id="hd_id3145991">ROUNDDOWN</h2>
-<paragraph id="par_id3146020" role="paragraph" xml-lang="en-US"><ahelp hid="HID_FUNC_ABRUNDEN">Rounds a number down, toward zero, to a certain precision.</ahelp></paragraph>
-
-<embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
-<paragraph id="par_id3146051" role="code" xml-lang="en-US">ROUNDDOWN(Number [; Count])</paragraph>
-<paragraph id="par_id3146064" role="paragraph" xml-lang="en-US">Returns <emph>Number</emph> rounded down (towards zero) to <emph>Count</emph> decimal places. If Count is omitted or zero, the function rounds down to an integer. If Count is negative, the function rounds down to the next 10, 100, 1000, etc.</paragraph>
-<paragraph id="par_id2188787" role="paragraph" xml-lang="en-US">This function rounds towards zero. See ROUNDUP and ROUND for alternatives.</paragraph>
-
-<embed href="text/scalc/01/common_func.xhp#sectionexample"/>
-<paragraph id="par_id3163178" role="paragraph" xml-lang="en-US"><item type="input">=ROUNDDOWN(1.234;2)</item> returns 1.23.</paragraph>
-<paragraph id="par_id5833307" role="paragraph" xml-lang="en-US"><item type="input">=ROUNDDOWN(45.67;0)</item> returns 45.</paragraph>
-<paragraph id="par_id7726676" role="paragraph" xml-lang="en-US"><item type="input">=ROUNDDOWN(-45.67)</item> returns -45.</paragraph>
-<paragraph id="par_id3729361" role="paragraph" xml-lang="en-US"><item type="input">=ROUNDDOWN(987.65;-2)</item> returns 900.</paragraph><comment>see also INT, TRUNC, ROUND, ROUNDUP, CEILING, FLOOR, EVEN, ODD, MROUND</comment>
+<section id="rounddown">
+ <h2 id="hd_id561641930400105"><link href="text/scalc/01/func_rounddown.xhp" name="rounddown_link">ROUNDDOWN</link></h2>
+ <embed href="text/scalc/01/func_trunc.xhp#trunc_desc"/>
</section>
<section id="Section19">
diff --git a/source/text/scalc/01/func_rounddown.xhp b/source/text/scalc/01/func_rounddown.xhp
new file mode 100644
index 0000000000..c346c44029
--- /dev/null
+++ b/source/text/scalc/01/func_rounddown.xhp
@@ -0,0 +1,52 @@
+<?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="rounddown_function" indexer="include" status="PUBLISH">
+ <title id="tit" xml-lang="en-US">ROUNDDOWN function</title>
+ <filename>/text/scalc/01/func_rounddown.xhp</filename>
+ </topic>
+</meta>
+
+<body>
+ <bookmark xml-lang="en-US" branch="index" id="bm_id3156384">
+ <bookmark_value>ROUNDDOWN function</bookmark_value>
+ <bookmark_value>numbers;rounding down</bookmark_value>
+ </bookmark>
+ <bookmark xml-lang="en-US" branch="hid/SC_HID_FUNC_ABRUNDEN" id="bm_id3146003" localize="false"/>
+ <h1 id="hd_id601641846107898"><variable id="rounddown_h1"><link href="text/scalc/01/func_rounddown.xhp" name="rounddown_link">ROUNDDOWN function</link></variable></h1>
+ <section id="rounddown_desc">
+ <paragraph role="paragraph" id="par_id841641927277474">Rounds down 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_trunc.xhp" name="TRUNC_link">TRUNC function</link>.</paragraph>
+ <embed href="text/scalc/01/func_trunc.xhp#trunc_tip"/>
+ <embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
+ <paragraph role="paragraph" id="par_id341641927560587">
+ <input>ROUNDDOWN(Number [; Count])</input>
+ </paragraph>
+ <section id="rounddown_parameters">
+ <paragraph role="paragraph" id="par_id11641927688319"><emph>Number:</emph> The number to be rounded down.</paragraph>
+ <paragraph role="paragraph" id="par_id861641927715672"><emph>Count:</emph> Optional paramenter 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>
+ <note id="par_id181641929609906">In %PRODUCTNAME the <emph>Count</emph> parameter is optional whereas in MS Excel this parameter is mandatory. When an ODS file contains a call to ROUNDDOWN without the <emph>Count</emph> parameter and the file is exported to XLS or XLSX formats, the missing argument will automatically be added with value zero to maintain compatibility.</note>
+ <embed href="text/scalc/01/common_func.xhp#sectionexample"/>
+ <paragraph role="paragraph" id="par_id901641928192870"><input>=ROUNDDOWN(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>=ROUNDDOWN(103.37,1)</input> returns 103.3.</paragraph>
+ <paragraph role="paragraph" id="par_id171641928456743"><input>=ROUNDDOWN(0.664,2)</input> returns 0.66.</paragraph>
+ <paragraph role="paragraph" id="par_id641641928712287"><input>=ROUNDDOWN(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">
+ <embed href="text/scalc/01/func_trunc.xhp#trunc_h1"/>
+ <embed href="text/scalc/01/04060106.xhp#math_functions_h1"/>
+ </section>
+</body>
+</helpdocument>
diff --git a/source/text/scalc/01/func_trunc.xhp b/source/text/scalc/01/func_trunc.xhp
new file mode 100644
index 0000000000..91801375d3
--- /dev/null
+++ b/source/text/scalc/01/func_trunc.xhp
@@ -0,0 +1,54 @@
+<?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" name="trunc_link">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" name="ROUNDDOWN_link">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 resulting number will always be smaller than or equal to the original number.</tip>
+ </section>
+ <embed href="text/scalc/01/common_func.xhp#sectionsyntax"/>
+ <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 paramenter 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/common_func.xhp#sectionexample"/>
+ <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">
+ <embed href="text/scalc/01/func_rounddown.xhp#rounddown_h1"/>
+ <embed href="text/scalc/01/04060106.xhp#math_functions_h1"/>
+ </section>
+</body>
+</helpdocument>