Computer Math CPS120: Binary Representations. Binary computers have storage units called binary...

10
Computer Math CPS120: Binary Representations

Transcript of Computer Math CPS120: Binary Representations. Binary computers have storage units called binary...

Page 1: Computer Math CPS120: Binary Representations. Binary computers have storage units called binary digits or bits: Low Voltage = 0 High Voltage = 1 all bits.

Computer Math

CPS120: Binary Representations

Page 2: Computer Math CPS120: Binary Representations. Binary computers have storage units called binary digits or bits: Low Voltage = 0 High Voltage = 1 all bits.

Binary computers have storage units called binary digits or bits:

Low Voltage = 0High Voltage = 1 all bits have 0 or 1

22

Binary and Computers

Page 3: Computer Math CPS120: Binary Representations. Binary computers have storage units called binary digits or bits: Low Voltage = 0 High Voltage = 1 all bits.

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 and Computers

Page 4: Computer Math CPS120: Binary Representations. Binary computers have storage units called binary digits or bits: Low Voltage = 0 High Voltage = 1 all bits.

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.

Page 5: Computer Math CPS120: Binary Representations. Binary computers have storage units called binary digits or bits: Low Voltage = 0 High Voltage = 1 all bits.

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.

Page 6: Computer Math CPS120: Binary Representations. Binary computers have storage units called binary digits or bits: Low Voltage = 0 High Voltage = 1 all 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

Page 7: Computer Math CPS120: Binary Representations. Binary computers have storage units called binary digits or bits: Low Voltage = 0 High Voltage = 1 all bits.

Binary Representations (Cont’d)

Figure 3.4 Bit combinations

Page 8: Computer Math CPS120: Binary Representations. Binary computers have storage units called binary digits or bits: Low Voltage = 0 High Voltage = 1 all bits.

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.

Page 9: Computer Math CPS120: Binary Representations. Binary computers have storage units called binary digits or bits: Low Voltage = 0 High Voltage = 1 all bits.

Memory Units 1 nibble 1 byte 1 word 1 long word 1 quad word 1 octa-word

4 consecutive bits 8 consecutive bits 2 consecutive bytes 4 consecutive bytes 8 consecutive bytes 16 consecutive

bytes

Page 10: Computer Math CPS120: Binary Representations. Binary computers have storage units called binary digits or bits: Low Voltage = 0 High Voltage = 1 all bits.

Larger Units of Memory 1 Kilobyte 1 Megabyte 1 Gigabyte 1 Terabyte 1 Petabyte 1 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