Difference between revisions of "Manuals/calci/INT"

From ZCubes Wiki
Jump to navigation Jump to search
Line 17: Line 17:
  
 
INT() can be used with multiple inputs as -
 
INT() can be used with multiple inputs as -
 +
 
INT(4.5,6.7,3.345,2) that ''displays 4,6,3,2 as a result''.
 
INT(4.5,6.7,3.345,2) that ''displays 4,6,3,2 as a result''.
  
*If the input is non-numeric, Calci displays a NaN error message.
+
*If the input is non-numeric, Calci displays a #NaN error message.
  
 
*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.  
 
*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.  
Line 70: Line 71:
 
==References==
 
==References==
  
*[http://en.wikipedia.org/wiki/Truncation TRUNC Function]
+
*[http://en.wikipedia.org/wiki/Rounding#Tie-breaking Rounding]

Revision as of 06:02, 27 November 2013

INT(number)

  • Where number is a number to be rounded.

INT() rounds a number down to the nearest integer.

Description

INT(number)

INT() function rounds a number to the nearest integer towards zero.

For Example,

INT(3.6) returns 3 as output. INT(-2.4) returns -3 as output.

INT() can be used with multiple inputs as -

INT(4.5,6.7,3.345,2) that displays 4,6,3,2 as a result.

  • If the input is non-numeric, Calci displays a #NaN error message.
  • 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

Function Output
INT(1000.34) 1000
INT(23.4546) 23
INT(-3.25) -4
INT(-0.222) -1

See Also

References