Difference between revisions of "Manuals/calci/TRUNC"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with "<div id="16SpaceContent" align="left"><div class="ZEditBox" align="justify"> Syntax </div></div> ---- <div id="4SpaceContent" align="left"><div class="ZEditBox" align=...")
 
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<div id="16SpaceContent" align="left"><div class="ZEditBox" align="justify">
+
<div style="font-size:30px">'''TRUNC (Number,Number_Digits)'''</div><br/>
 +
*Where 'Number' is the number to truncate and
 +
*'Number_Digits' is a number specifying the number of decimal places to be displayed in the result.
 +
**TRUNC(), truncates a number to an integer.
  
Syntax
 
  
</div></div>
+
== Description ==
----
 
<div id="4SpaceContent" align="left"><div class="ZEditBox" align="justify">
 
  
Remarks
+
TRUNC (Number,Number_Digits)
  
</div></div>
+
For Example,
----
 
<div id="2SpaceContent" align="left"><div class="ZEditBox" align="justify">
 
  
Examples
+
TRUNC(56.6878,2) ''returns 56.68'' as a result.
  
</div></div>
+
*If digits is not specified, Calci considers it as 0.
----
+
*TRUNC() and INT() functions are somewhat similar. TRUNC() removes the fractional part of the number, where as INT() rounds the number down to nearest integer.
<div id="8SpaceContent" align="left"><div class="ZEditBox" align="justify">'''<font face="Times New Roman">''''''''''''<font size="6"> </font>''' '''''''''</font>'''</div></div>
+
*INT() and TRUNC() work differently with negative numbers.
----
 
<div id="11SpaceContent" align="left"><div class="ZEditBox mceEditable" align="justify">
 
  
<font size="5">Description</font>
+
INT(-45.1) ''returns -46'' whereas
 +
 +
TRUNC(-45.1) ''returns -45''
 +
*TRUNC() can be combined with other functions as below -
  
</div></div>
+
TRUNC(SUM(3.4545,6.7878),2) ''returns 10.24'' as a result.
----
+
*If the input is non-numeric, Calci displays an error message.
<div id="10SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify">'''<font face="Times New Roman"> <font size="6">TRUNC</font> </font>'''</div></div>
 
----
 
<div id="3SpaceContent" class="zcontent" align="left"><br /><div id="7Space" class="gamizbox" title="7Space"><div id="7SpaceHeader" class="zheaderstyle" title="Double-click to start and stop editing the header."><center></center></div><div id="7SpaceRollup" title="Double-click to rolldown" align="left"><span><span id="7SpaceRollupContent" align="center"></span></span></div><div id="7SpaceCover"><div id="7SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify"><font size="3" face="Times New Roman"> </font>
 
  
'''TRUNC''' (n, m)
+
== Examples ==
 +
<div id="6SpaceContent" class="zcontent" align="left">
 +
 
 +
{| id="TABLE3" class="SpreadSheet blue"
 +
|- class="even"
 +
| class="  " | '''Function'''
 +
| class="  " | '''Output'''
 +
 
 +
|- class="odd"
 +
| class="sshl_f" |TRUNC(1000.34,1)
 +
| class="sshl_f" |1000.3
 +
 
 +
|- class="even"
 +
| class="sshl_f" |TRUNC(23.4546,4)
 +
| class="sshl_f" |23.4546
 +
 
 +
|- class="odd"
 +
| class="sshl_f" |TRUNC(34.98989898)
 +
| class="sshl_f" |34
 +
 
 +
|- class="even"
 +
| class="sshl_f" |TRUNC(-3.25)
 +
| class="sshl_f" |-3
 +
 
 +
|- class="odd"
 +
| class="sshl_f" |TRUNC(-222,2)
 +
| class="sshl_f" |-222
 +
|}
 +
 
 +
==Related Videos==
 +
 
 +
{{#ev:youtube|LOqMKliIYGU|280|center|TRUNC}}
 +
 
 +
== See Also ==
 +
 
 +
*[[Manuals/calci/INT | INT]]
 +
 
 +
*[[Manuals/calci/ROUND | ROUND]]
  
Where n is the number to truncate and m is a number specifying the accuracy of the truncation.
+
*[[Manuals/calci/ROUNDUP | ROUNDUP]]
  
</div></div>
+
*[[Manuals/calci/ROUNDDOWN | ROUNDDOWN]]
----
 
<div id="13SpaceContent" class="zcontent" align="left"><br /><br /><div id="1Space" class="gamizbox" title="1Space"><div id="1SpaceHeader" class="zheaderstyle" title="Double-click to start and stop editing the header."><center></center></div><div id="1SpaceRollup" title="Double-click to rolldown" align="left"><span><span id="1SpaceRollupContent" align="center"></span></span></div><div id="1SpaceCover"><div id="1SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify">In some cases TRUNC and INT are similar. INT and TRUNC are different only when using negative numbers.</div></div>
 
----
 
<div id="14SpaceContent" class="zcontent" align="left"><br /><br /><br /><div id="5Space" class="gamizbox" title="5Space"><div id="5SpaceHeader" class="zheaderstyle" title="Double-click to start and stop editing the header."><center></center></div><div id="5SpaceRollup" title="Double-click to rolldown" align="left"><span><span id="5SpaceRollupContent" align="center"></span></span></div><div id="5SpaceCover"><div id="5SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify"><font size="3"><font face="Times New Roman"> 
 
  
TRUNC function truncates a number to an integer. This step is by removing the fractional part of the number.
+
*[[Manuals/calci/CEILING | CEILING]]
  
</font></font></div></div>
+
*[[Manuals/calci/FLOOR | FLOOR]]
----
 
<div id="12SpaceContent" class="zcontent" align="left"><br /><br /><br /><div id="9Space" class="gamizbox" title="9Space"><div id="9SpaceHeader" class="zheaderstyle" title="Double-click to start and stop editing the header."><center></center></div><div id="9SpaceRollup" title="Double-click to rolldown" align="left"><span><span id="9SpaceRollupContent" align="center"></span></span></div><div id="9SpaceCover"><div id="9SpaceContent" class="zcontent" align="left"><div class="ZEditBox" align="justify"><font size="3"><font face="Times New Roman"> 
 
  
Lets see an example in (Column1 Row 1, Column2 Row1)
+
==References==
  
TRUNC (R)
+
*[http://en.wikipedia.org/wiki/Truncation TRUNC Function]
  
TRUNC (C1R1, C2R1)''''''
 
  
That is =TRUNC (10, 12) is 10
 
  
</font></font></div></div>
 
----
 
<div id="6SpaceContent" class="zcontent" align="left">
 
  
{| id="TABLE3" class="SpreadSheet blue"
+
*[[Z_API_Functions | List of Main Z Functions]]
|- class="even"
 
| class="  " |
 
<div id="6Space_Copy" title="Click and Drag over to AutoFill other cells."></div>
 
| Column1
 
| class="  " | Column2
 
| class="  " | Column3
 
| class="  " | Column4
 
|- class="odd"
 
| class=" " | Row1
 
| class="sshl_f" | 10
 
| class="sshl_f" | 12
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|- class="even"
 
| class="  " | Row2
 
| class="sshl_f" | 10
 
| class="sshl_f    " |
 
<div id="6Space_Copy" title="Click and Drag over to AutoFill other cells."></div>
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|- class="odd"
 
| Row3
 
| class="sshl_f SelectTD SelectTD" |
 
| class="sshl_f" |
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|- class="even"
 
| Row4
 
| class="sshl_f" |
 
| class="sshl_f" |
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|- class="odd"
 
| class=" " | Row5
 
| class="sshl_f" |
 
| class="sshl_f" |
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|- class="even"
 
| Row6
 
| class="sshl_f" |
 
| class="sshl_f" |
 
| class="sshl_f" |
 
| class="sshl_f" |
 
|}
 
  
<div align="left">[[Image:calci1.gif]]</div></div>
+
*[[ Z3 |  Z3 home ]]
----
 
</div></div></div></div></div></div></div></div></div></div></div></div>
 

Latest revision as of 15:52, 21 August 2018

TRUNC (Number,Number_Digits)


  • Where 'Number' is the number to truncate and
  • 'Number_Digits' is a number specifying the number of decimal places to be displayed in the result.
    • TRUNC(), truncates a number to an integer.


Description

TRUNC (Number,Number_Digits)

For Example,

TRUNC(56.6878,2) returns 56.68 as a result.

  • If digits is not specified, Calci considers it as 0.
  • TRUNC() and INT() functions are somewhat similar. TRUNC() removes the fractional part of the number, where as INT() rounds the number down to nearest integer.
  • INT() and TRUNC() work differently with negative numbers.

INT(-45.1) returns -46 whereas

TRUNC(-45.1) returns -45

  • TRUNC() can be combined with other functions as below -

TRUNC(SUM(3.4545,6.7878),2) returns 10.24 as a result.

  • If the input is non-numeric, Calci displays an error message.

Examples

Function Output
TRUNC(1000.34,1) 1000.3
TRUNC(23.4546,4) 23.4546
TRUNC(34.98989898) 34
TRUNC(-3.25) -3
TRUNC(-222,2) -222

Related Videos

TRUNC

See Also

References