Introduction To Number Representation Introduction To Number Representation
Introduction To Number Representation Introduction To Number Representation
Introduction to
to
Number
Number
Representation
Representation
Binary
Binary Numbers
Numbers
Sign/Magnitude
Sign/Magnitude
2s
2s Complement
Complement
128 + 4 + 2 + 1 = 135
MSB
MSB LSB
LSB
128 64 32 16 8 4 2 1
1 0 0 0 0 1 1 1
The
The repeated
repeated division
division method
method
A method for converting denary to binary:
98 in denary into binary:
98 divide by 2 = 49 remainder 0
49 divide by 2 = 24 remainder 1
24 divide by 2 = 12 remainder 0
12 divide by 2 = 6 remainder 0
6 divide by 2 = 3 remainder 0
DIV
DIV
3 divide by 2 = 1 remainder 1
1 divide by 2 = 0 remainder 1
0 divide by 2 = 0 remainder 0 MOD
MOD
Read the binary code from the remainder from bottom to the top:
8 4 2 1 8 4 2 1 8 4 2 1
1 0 0 1 0 0 1 1 1 0 0 0
8+0+0+1 0+0+2+1 8+0+0+0
Therefore91001 0011 1000 in BCD
3 = 938 in denary. 8
Uses
Uses of
of BCD
BCD
BCD enables fast
conversions from
denary to binary for
applications such as
pocket calculators.
Each digit on a
calculator corresponds
directly to a four-bit
block in BCD.
Storing
Storing Negative
Negative Integers
Integers
1 method is Sign/Magnitude
75
-75
MSB
MSB
+/- 64 32 16
128 8 4 2 1
1
0 1 0 0 1 0 1 1
11is
isaaNegative,
Negative,00is
isaa Positive
Positive
Sign/Magnitude
Sign/Magnitude
This method has some limitations
Makes calculations difficult by losing 1 bit
127
127 maximum
maximum number
number
+/- 64 32 16 8 4 2 1
0 1 0 0 1 0 1 1
Sign
Sign
Value
Value or
or Magnitude
Magnitude
Storing
Storing Negative
Negative Integers
Integers
Another method is 2s Complement
-75
128 64 32 16
-128 8 4 2 1
1 0 1 1 0 1 0 1
-128+32+16+4+1=-75
2s
2s Complement
Complement Conversion
Conversion
-117
Stage 1 : work out 117 in binary
128 64 32 16 8 4 2 1
0 1 1 1 0 1 0 1
Stage 2 : Reverse the 0’s and 1’s
-128 64 32 16 8 4 2 1
1 0 0 0 1 0 1 10
Stage 3 : Plus 1
Representing
Representing characters
characters