Difference between revisions of "Manuals/calci/TRUNC"

From ZCubes Wiki
Jump to navigation Jump to search
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=TRUNC(number, digits)=
+
<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.
  
*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 ==
 
== Description ==
  
TRUNC(number, digits)
+
TRUNC (Number,Number_Digits)
  
 
For Example,
 
For Example,
Line 18: Line 17:
 
*INT() and TRUNC() work differently with negative numbers.
 
*INT() and TRUNC() work differently with negative numbers.
  
INT(-45.1) ''returns -45'' whereas
+
INT(-45.1) ''returns -46'' whereas
 
   
 
   
TRUNC(-45.1) ''returns -46''
+
TRUNC(-45.1) ''returns -45''
 
*TRUNC() can be combined with other functions as below -
 
*TRUNC() can be combined with other functions as below -
  
Line 54: Line 53:
 
| class="sshl_f" |-222
 
| class="sshl_f" |-222
 
|}
 
|}
 +
 +
==Related Videos==
 +
 +
{{#ev:youtube|LOqMKliIYGU|280|center|TRUNC}}
  
 
== See Also ==
 
== See Also ==
Line 70: Line 73:
  
 
==References==
 
==References==
 +
 
*[http://en.wikipedia.org/wiki/Truncation TRUNC Function]
 
*[http://en.wikipedia.org/wiki/Truncation TRUNC Function]
 +
 +
 +
 +
 +
*[[Z_API_Functions | List of Main Z Functions]]
 +
 +
*[[ Z3 |  Z3 home ]]

Latest revision as of 16: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