110 likes | 295 Views
Number Systems. Part 2. Counting in Binary. 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.
E N D
Number Systems Part 2
Counting in Binary 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:
Number of Bits and No. of possible values Largest Number represented in 8 bits: =128 + 64 + 32+16+8+4+2+1 =255
Number of Bits, No. of possible values and Range Number of possible values = 2N Range: 0 to 2N -1 (28 =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: - (2N -1) to + (2N -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 • 100000010 • Add 6 zeros to make a total of N-1 bits • 000000100000010 • Add an extra one on the left to show that the number is negative • 1000000100000010
Representation of Zero in Sign and Magnitude Representation • Issue: Two representations of zero • +0 00000000 • -0 10000000