1. Data Representation
i. The Binary System
Reasons for using binary
Easy to represent ‘ON’ and ‘OFF’ as 0 Volts and a higher voltage (often above 1V – nominally 5V). Fewer rules needed with binary (0, 1) arithmetic than with decimal (0..9) arithmetic. Any loss of voltage due to resistance etc does not change value. Easy to represent 0, 1 with other devices e.g. pits and lands on a CDROM or directions of magnetic field on a hard disc.
Binary Arithmetic
Bits – a binary digit. Byte – 8 bits Kilobyte – 1024 bytes (210 bytes) Megabyte – 1024 x 1024 bytes Gigabyte – 1024 x 1024 x 1024 bytes Terabyte – 1024 x 1024 x 1024 x 1024 bytes
Place Values the values are doubled as you add more digits starting from the least significant bit 128 64 32 16 8 4 2 1
Most significant bit Least significant bit
Converting between binary and decimal Add the place values e.g. 1011 1001 = 1 +8 + 16 + 32 + 128 = 185 in decimal Converting between decimal and binary Divide repeatedly by 2.
ii.
Storing Numbers
Positive integers are stored as described above Negative integers are stored either using signed bit or 2’s complement. Signed Bit The most significant bit is 0 if the number is +ve, 1 if –ve. However there are two zeroes (+0 and –0) and the ordinary rules of arithmetic don’t work. 2’s complement To find the 2’s complement of a number change all 0’s to 1’s and 1’s to 0’s. Then add 1. Only one zero and all the ordinary rules of arithmetic work. The most significant bit will be a 1 if the number is –ve.
Ron Loan
Currie Community High School
1
Computer Systems
Floating Point Numbers are stored using mantissa and exponent. E.g. 1011.11 is equal to .101111 X 2 100 (since 100 in binary is 4 in decimal and the point has been moved 4 places) This is stored as 101111 in the mantissa, 100 as the exponent. Because of the number of bits being used to store the number is limited. The mantissa cannot be exactly accurate. Increasing