Long integer: Difference between revisions
No edit summary |
No edit summary |
||
Line 16: | Line 16: | ||
|- |
|- |
||
| [[C (programming)|C]] and [[C++]] ISO/ANSI and C++/CLI |
| [[C (programming)|C]] and [[C++]] ISO/ANSI and C++/CLI |
||
| [[Unix]] [[Windows]], 32-bit/16 |
| [[Unix]], [[Windows]], 32-bit/16 |
||
| long or long int |
| long or long int |
||
| 4 <ref>{{cite web|url=http://www.cplusplus.com/doc/tutorial/variables.html|title=Variables. Data Types. }}</ref> or 2 under 16bit version of Visual C++ |
| 4 <ref>{{cite web|url=http://www.cplusplus.com/doc/tutorial/variables.html|title=Variables. Data Types. }}</ref> or 2 under 16bit version of Visual C++ |
Revision as of 18:05, 25 December 2009
In computer science, a long integer is a data type that can represent a positive or negative whole number whose range is greater than or equal to that of a standard integer on the same machine.
In practice it is usual for a long integer to require double the storage capacity of a standard integer, although this is not always the case. In later versions of the C programming language, a long long type is supported that doubles the capacity of the standard long to 64 bits. This type is not supported by compilers that require C code to be C++ ISO compliant, because the long long type does not exist in C++.
A variable defined as a long integer in one programming language may be different in size to a similarly defined variable in another. In some languages this size is fixed across platforms, whilst in others it is machine dependent. In some languages this data type does not exist at all.
Common sizes
Programming language | Platforms | Data type name | Storage in bytes | Range (Signed) | Range (Unsigned) |
---|---|---|---|---|---|
C and C++ ISO/ANSI and C++/CLI | Unix, Windows, 32-bit/16 | long or long int | 4 [1] or 2 under 16bit version of Visual C++ | −2,147,483,648 to 2,147,483,647 | 0 to 4,294,967,296 |
VB | Windows | Long | 4 [2] | −2,147,483,648 to 2,147,483,647 | N/A |
VBA | Windows, Mac OS | Long | 4 [3] | −2,147,483,648 to 2,147,483,647 | N/A |
SQL Server | Windows | BigInt | 8 | −9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 | 0 to 18,446,744,073,709,551,615 |
.NET CLR/CTS | Windows | Long or Int64 | 8 | −9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 | 0 to 18,446,744,073,709,551,615 |
Java | Java platform | long | 8 | −9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 | N/A |
Pascal | Windows | int64 | 8 | −9,223,372,036,854,775,808 to +9,223,372,036,854,775,807 | N/A |
- ^ "Variables. Data Types".
- ^ VB 6.0 help file
- ^ "The Integer, Long, and Byte Data Types (VBA)". Retrieved 2006-12-19.