Difference Between Similar Terms and Objects

Difference Between Signed and Unsigned

Signed vs Unsigned

Our number system extends from negative infinity to positive infinity with zero right at the middle. However, in programming, there are basically two types of numbers; the signed and unsigned. The main difference between a signed and an unsigned number is, well, the ability to use negative numbers. Unsigned numbers can only have values of zero or greater. In contrast, signed numbers are more natural with a range that includes negative to positive numbers.

The creation of signed and unsigned numbers was prompted by the need to represent numeric values with very limited resources. For example, using 8 bits, you only have a total of 256 combinations. With an unsigned number, that means any value between 0 and 255. In contrast, having a signed number means you already lose a bit for representing the sign. With 7 bits you have a maximum of 128 combinations so your range with an 8 bit signed number is from -128 to 127. So if you have limited resources, like in the early days of computing, using unsigned numbers was the way to go.

When using signed and unsigned numbers in programming, it is safer to just use one or the other as simultaneously using both can result in problems. The first is when you compare an unsigned to a signed number. This typically results in warnings, but the compiler could compile it anyway. The second and more serious problem is when you assign the contents of an unsigned number to a signed number. If the value of the unsigned number is greater than the maximum value of the signed number, this would result in an error.

As technology developed, resources have become more abundant, and the use of unsigned numbers is becoming less and less necessary. To illustrate this, keep in mind that a 32 bit long number can have a maximum signed value of 2 million or 4 million if it’s unsigned. When you move into 64 bits, the difference is between 90 and 180 quintillion; values that are rarely used if at all in common programs.


1.Unsigned number only include zero and positive numbers while signed numbers include negative numbers.
2.Signed numbers have half the maximum value of unsigned numbers.
3.Mixing signed and unsigned numbers can result in problems.
4.Using signed or unsigned numbers have little bearing in modern applications.

Sharing is caring!

Search DifferenceBetween.net :

Email This Post Email This Post : If you like this article or our site. Please spread the word. Share it with your friends/family.

Leave a Response

Please note: comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.

Articles on DifferenceBetween.net are general information, and are not intended to substitute for professional advice. The information is "AS IS", "WITH ALL FAULTS". User assumes all risk of use, damage, or injury. You agree that we have no liability for any damages.

See more about :
Protected by Copyscape Plagiarism Finder