5.3 Representing Data - The Binary Number System
5.3 Representing Data - The Binary Number System
00110010+
10110101
11100111
11
• Starting at the LSB, write out the number again until you come to
the first 1.
• Then reverse all the remaining bits, that is, 0 becomes 1 and 1
becomes 0.
• The number becomes 10011010.
• The number is now in two’s complement.
–128 64 32 16 8 4 2 1
1 0 0 1 1 0 1 0
Computer Science
Fixed point numbers
• In order to represent real decimal numbers, that is,
numbers with decimal places or a fractional part, fixed
point representation can be used.
• In the same way that decimal has a decimal point, binary
has a binary point.
• The binary point is not actually stored in the 8-bit code –
its position is fixed by the programmer. It is shown here
purely to aid understanding.
8 4 2 1 ½ ¼ 1/
8
1/
16
0 1 1 0 0 1 1 0
-8 4 2 1 ½ ¼ 1/
8
1/
16
1 1 1 0 1 1 0 0
0 0 0 0 1 1 0 0
• The point now floats three places to the right. The values
for the conversion have changed because the binary
point has now moved.
-8 4 2 1 1/
2
1/
4
1/
8
1/
16
0 0 0 0 1 1 0 0