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=...")
 
Line 1: Line 1:
<div id="16SpaceContent" align="left"><div class="ZEditBox" align="justify">
+
=TRUNC(number, digits)=
  
Syntax
+
*Where 'number' is the number to truncate and
 +
*'digits' is a number specifying the number of decimal places to be displayed in the result.
  
</div></div>
+
TRUNC() truncates a number to specified number of digits.
----
 
<div id="4SpaceContent" align="left"><div class="ZEditBox" align="justify">
 
  
Remarks
+
== Description ==
  
</div></div>
+
TRUNC(number, digits)
----
 
<div id="2SpaceContent" align="left"><div class="ZEditBox" align="justify">
 
  
Examples
+
For Example,
  
</div></div>
+
TRUNC(56.6878,2) ''returns 56.68'' as a result.
----
 
<div id="8SpaceContent" align="left"><div class="ZEditBox" align="justify">'''<font face="Times New Roman">''''''''''''<font size="6"> </font>''' '''''''''</font>'''</div></div>
 
----
 
<div id="11SpaceContent" align="left"><div class="ZEditBox mceEditable" align="justify">
 
  
<font size="5">Description</font>
+
*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.
  
</div></div>
+
INT(-45.1) ''returns -45'' whereas
----
+
TRUNC(-45.1) ''returns -46''
<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 ==
 
 
Where n is the number to truncate and m is a number specifying the accuracy of the truncation.
 
 
 
</div></div>
 
----
 
<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.
 
 
 
</font></font></div></div>
 
----
 
<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)
 
 
 
TRUNC (R)
 
 
 
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"
 
|- 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>
 
----
 
</div></div></div></div></div></div></div></div></div></div></div></div>
 

Revision as of 15:46, 24 November 2013

TRUNC(number, digits)

  • Where 'number' is the number to truncate and
  • 'digits' is a number specifying the number of decimal places to be displayed in the result.

TRUNC() truncates a number to specified number of digits.

Description

TRUNC(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 -45 whereas TRUNC(-45.1) returns -46

Examples