Number Systems Part 2
Counting in Binary DecimalBinary When the symbols for the first digit are exhausted, the next- higher digit (to the left) is incremented, and counting starts over at 0.
Byte The byte is a unit of digital information in computing and telecommunications. It is an ordered collection of bits, in which each bit denotes the binary value of 1 or 0. A byte is composed of 8 bits.
Byte Prefixes When you start talking about lots of bytes, you get into prefixes like kilo, mega and giga, as in kilobyte, megabyte and gigabyte (also shortened to K, M and G, as in Kbytes, Mbytes and Gbytes or KB, MB and GB). The following table shows the binary multipliers:
Summary of Conversions DecimalBinaryOctalHexadecimal DecimalRepeatedly Divide By 2 Repeatedly Divide By 8 Repeatedly Divide By 16 BinaryMultiply digits by Powers of 2 Group bits into sets of 3 Group bits into sets of 4 OctalMultiply digits by Powers of 8 Represent digits in groups of 3 bits Convert to Binary, Convert to Hex HexadecimalMultiply digits by Powers of 16 Represent digits in groups of 4 bits Convert to Binary, Convert to Oct
Number of Bits and No. of possible values Largest Number represented in 8 bits: = =255
Number of Bits, No. of possible values and Range Number of possible values = 2 N Range: 0 to 2 N -1(2 8 =256) = 0 to 255
Signed Integer Representation Sign and Magnitude One’s Complement Two’s Complement
Sign and Magnitude Requires one bit to represent sign – 0 for positive – 1 for negative In 8 bit allocation you can only use 7 bits to represent absolute value of a number Range: - (2 N -1) to + (2 N -1) = -127 to +127
Example Store -258 in a 16 bit memory location using sign-and-magnitude representation Solution: – First change the number to binary – Add 6 zeros to make a total of N-1 bits – Add an extra one on the left to show that the number is negative
Representation of Zero in Sign and Magnitude Representation Issue: Two representations of zero – +0 – -0