Binary Representations

Download Report

Transcript Binary Representations

Computer Math
CPS120: Binary Representations
Binary and Computers
Binary computers have storage units called binary
digits or bits:
Low Voltage = 0
High Voltage = 1
all bits have 0 or 1
22
Binary and Computers
8 bits = 1 byte
The number of bytes in a word determines the
word length of the computer:
32-bit machines
64-bit machines etc.
23
Binary Representations


One bit can be either 0 or 1. Therefore,
one bit can represent only two things.
To represent more than two things, we
need multiple bits. Two bits can
represent four things because there are
four combinations of 0 and 1 that can
be made from two bits: 00, 01, 10,11.
Binary Representations

(Cont’d)
If we want to represent more than four
things, we need more than two bits.
Three bits can represent eight things
because there are eight combinations of
0 and 1 that can be made from three
bits.
Binary & Alphanumeric Codes

A binary code is a group of n bits that
assume up to 2n distinct combinations
of 1’s and 0’s with each combination
representing one element of the set
that is being coded- i.e. permutations



With two bits we can form a set of four
elements
With three bits we can represent 8 elements
With four bits we can represent 16 elements
Binary Representations
Figure 3.4
Bit combinations
(Cont’d)
Binary Representations

(Cont’d)
In general,  bits can represent 2
things because there are 2
combinations of 0 and 1 that can be
made from n bits. Note that every time
we increase the number of bits by 1, we
double the number of things we can
represent.
Memory Units






1
1
1
1
1
1
nibble
byte
word
long word
quad word
octa-word






4 consecutive bits
8 consecutive bits
2 consecutive bytes
4 consecutive bytes
8 consecutive bytes
16 consecutive bytes
Larger Units of Memory






1
1
1
1
1
1
Kilobyte
Megabyte
Gigabyte
Terabyte
Petabyte
Exabyte






1024 bytes
~106 bytes
~109 bytes
~1012 bytes
~1015 bytes
~1018 bytes
32 Mb = 32*103 Kb = 32 * 103 *1024 bytes = 32,768,000 bytes