Data Representation Refers To The Form in Which Data Is Stored, Processed, and Transmitted
Data Representation Refers To The Form in Which Data Is Stored, Processed, and Transmitted
Data Representation refers to the form in which data is stored, processed, and transmitted.
The 0s and 1s used to represent digital data are referred to as binary digits — from this term we
get the word bit that stands for binary digit.
A bit is a 0 or 1 used in the digital representation of data.
Decimal Base = 10
Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
Binary Base = 2
Digit Set = {0, 1}
Octal Base = 8 = 23
Digit Set = {0, 1, 2, 3, 4, 5, 6, 7}
Hexadecimal Base = 16 = 24
Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}
In the standard interpretation, always used in this course, an N–bit unsigned integer will represent
2N integer values in the range 0 through 2 N – 1, inclusive. Sample ranges include:
N = 4 0 through 24 – 1 0 through 15
N = 8 0 through 28 – 1 0 through 255
N = 12 0 through 212 – 1 0 through 4095
N = 16 0 through 216 – 1 0 through 65535
N = 20 0 through 220 – 1 0 through 1,048,575
N = 32 0 through 232 – 1 0 through 4,294,967,295
Conversion of integers from decimal to binary is done by repeated integer division with keeping of
the integer quotient and noting the integer remainder. The remainder numbers are then read top to
bottom as least significant bit to most significant bit. Here is an example.
For signed binary numbers the most significant bit (MSB) is used as the sign bit. If the sign bit is
“0”, this means the number is positive in value. If the sign bit is “1”, then the number is negative in
value. The remaining bits in the number are used to represent the magnitude of the binary number
in the usual unsigned binary number format way.
Then we can see that the Sign-and-Magnitude (SM) notation stores positive and negative values by
dividing the “n” total bits into two parts: 1 bit for the sign and n–1 bits for the value which is a pure
binary number. For example, the decimal number 53 can be expressed as an 8-bit signed binary
number as follows:
So, for example, if we have 4 bits to represent a signed binary number, (1-bit for the Sign bit and
3-bits for the Magnitude bits), then the actual range of numbers we can represent in sign-
magnitude notation would be:
-2(4-1) – 1 to +2(4-1) – 1
-2(3) – 1 to +2(3) – 1
-7 to +7
Whereas before, the range of an unsigned 4-bit binary number would have been from 0 to 15,
or 0 to F in hexadecimal, we now have a reduced range of -7 to +7. Thus, an unsigned binary
number does not have a single sign-bit, and therefore can have a larger binary range as the most
significant bit (MSB) is just an extra bit or digit rather than a used sign bit.
Another disadvantage here of the sign-magnitude form is that we can have a positive result for
zero, +0 or 00002, and a negative result for zero, -0 or 10002. Both are valid but which one is
correct.
One’s Complement or 1’s Complement as it is also termed, is another method which we can use
to represent negative binary numbers in a signed binary number system. In one’s complement,
positive numbers (also known as non-complements) remain unchanged as before with the sign-
magnitude numbers.
Negative numbers, however, are represented by taking the one’s complement (inversion, negation)
of the unsigned positive number. Since positive numbers always start with a “0”, the complement
will always start with a “1” to indicate a negative number.
In two’s complement form, a negative number is the 2’s complement of its positive number with
the subtraction of two numbers being A – B = A + ( 2’s complement of B ) using much the same
process as before as basically, two’s complement is one’s complement + 1.
The main advantage of two’s complement over the previous one’s complement is that there is no
double-zero problem plus it is a lot easier to generate the two’s complement of a signed binary
number. Therefore, arithmetic operations are relatively easier to perform when the numbers are
represented in the two’s complement format.
Let’s look at the subtraction of our two 8-bit numbers 115 and 27 from above using two’s
complement, and we remember from above that the binary equivalents are:
11510 in binary is: 011100112
2710 in binary is: 000110112
Our numbers are 8-bits long, then there are 28 digits available to represent our values and in binary
this equals: 1000000002 or 25610. Then the two’s complement of 2710 will be:
(28)2 – 00011011 = 100000000 – 00011011 = 111001012
Sign bit
This occupies just one bit and represents the sign: 0 for positive and 1 for negative.
Exponent
The exponent section for a 16-bit (half-precision) floating point occupies 5 bits and stores the
exponent value described above. For 32-bit (single-precision) as in the above binary32 example,
this section occupies 8 bits; for 64-bit (double-precision) formats this section will occupy 11 bits.