- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Unsigned binary integers
Unsigned binary integers are numbers without any ‘+’or ‘-’ sign. Here all bits representing the number will represent the magnitude part of the number only. No bits will remain reserved for sign bit representation. An unsigned binary integer is a fixed-point system with no fractional digits.
Some real life Examples are −
Number of tables in a class,
The number of a member of a family.
Obviously, they are unsigned integers like 10 and 5. These numbers have to be represented in a computer using only binary notation or using bits.
Numbers are represented in a computer using a fixed size, like 4, 8, 16, 32 bits, etc. If numbers are represented in a computer using 8 bits, it is said that the computer uses 8-bit word size. Generally, word sizes are a power of 2. Modern computers typically support binary integers of 8 (i.e. 23),16 (i.e. 24),32 (i.e. 25),or 64 (i.e. 26)bits.A tabular column of some decimal numbers and their equivalent in unsigned binary is shown in the following, assuming a word size of 4bits.
Number | Unsigned binary notation |
---|---|
5 | 0101 |
13 | 1101 |
0 | 0000 Minimum number, which is 0 |
15 | 1111 Maximum number, which is (24 -1) |
In this table,
5 in binary representation is −
2 | 5 |
2 | 2 Remainder 1 |
2 | 1 Remainder 0 |
2 | 0 Remainder 1 |
So it is − 0101
And 0101 in decimal representation is − 0*23 +1*22 +0*21 +1*20
From this, it is obvious that if the word size is n bits, the range of (2n –1) numbers can be represented as ranging from 0 to (2n –1). A table of word size and the range of unsigned integers that can be represented is shown here –
Word size | The range for unsigned numbers |
---|---|
4 | 0 to 24- 1 or 0 to 15 |
8 | 0 to 28- 1 or 0 to 255 |
16 | 0 to 216- 1 or 0 to 65535 |
32 | 0 to 232- 1 or 0 to 4,294,967,295 |
64 | 0 to 264-1 or 0 to 1.844674407x 1019 |
In other words, when the word size is only 4 bits, it is not possible to represent a number like 223. The minimum word size has to be 8 bits to represent the number 223.