Long is a data type used in programming languages, such as Java,C++, and (C#|c_sharp). A constant orvariable defined as long can store a single 64-bit signed integer.

So what constitutes a 64-bit signed integer? It helps to break down each word, starting from right to left. Aninteger is a whole number that does not include a decimal point. Examples include 1, 99, or 234536. “Signed” means the number can be either positive or negative, since it may be preceded by a minus (-) symbol. 64-bit means the number can store 263 or 18,446,744,073,709,551,616 different values (since one bit is used for the sign). Because the long data type is signed, the possible integers range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807, including 0.

In modern programming languages, the standard integer (int) data type typically stores a 32-bit whole number. Therefore, if a variable or constant may potentially store a number larger than 2,147,483,647 (231 ÷ 2), it should be defined as a long instead of an int.

NOTE: In standard C, a long integer may be limited to a 32-bit value ranging from -2,147,483,648 to 2,147,483,647.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s