Difference between revisions of "Integer"

m
m (Integers in Computer Science)
(3 intermediate revisions by 2 users not shown)
Line 4: Line 4:
  
 
==Integers in Computer Science==
 
==Integers in Computer Science==
In [[Python]] and just about all other programming languages integers are a primitive [[datatype]].  Unlike [[floating point number]]s, integers are always stored exactly, and never approximated.  However, in most languages integers are stored in a fixed amount of space (typically 32 bits), which limits their maximum value (typically to <math>2^{31}-1</math> for signed 32-bit integers). Integers in Python can be of arbitrary size, theoretically limited only by computer memory.
+
In [[Python]] and just about all other programming languages, integers are a primitive [[datatype]], and can be used to put a quantitative value to variables.  Unlike [[floating point number]]s, integers are always stored exactly, and never approximated.  However, in most languages integers are stored in a fixed amount of space (typically <math>32</math> bits), which limits their maximum value (typically to <math>2^{31}-1</math> for signed <math>32</math>-bit integers). Integers in Python can be of arbitrary size, theoretically limited only by computer memory.
  
All the standard numerical [[operator]]s work on integers, as will the [[relational operator]]s.
+
All the standard numerical [[operator]]s work on integers, as will the [[operators#Relational Operators|relational operators]].
  
 
== See Also ==
 
== See Also ==
 
* [[Number line]]
 
* [[Number line]]
 +
* [http://docs.python.org/py3k/library/stdtypes.html#typesnumeric Python 3.2 Documentation]
  
 
[[Category:Definition]]
 
[[Category:Definition]]

Revision as of 23:27, 16 August 2013

An integer is one of the numbers obtained in counting the natural numbers ($1,2,3,\ldots$), zero ($0$), or the negatives of the natural numbers ($-1,-2,-3,\ldots$). If $a$ and $b$ are integers, then their sum $a+b$, their difference $a-b$, and their product $ab$ are all integers (that is, the integers are closed under addition and multiplication), but their quotient $a\div b$ may or may not be an integer, depending on whether $a$ can be divided by $b$ with no remainder.

The class of integers is the simplest class of numbers and is used to construct other classes like the rational numbers and real numbers. The set of integers is symbolically written as $\mathbb{Z}$.

Integers in Computer Science

In Python and just about all other programming languages, integers are a primitive datatype, and can be used to put a quantitative value to variables. Unlike floating point numbers, integers are always stored exactly, and never approximated. However, in most languages integers are stored in a fixed amount of space (typically $32$ bits), which limits their maximum value (typically to $2^{31}-1$ for signed $32$-bit integers). Integers in Python can be of arbitrary size, theoretically limited only by computer memory.

All the standard numerical operators work on integers, as will the relational operators.

See Also