Presentation is loading. Please wait.

Presentation is loading. Please wait.

How to Represent Numbers on a Computer

Similar presentations


Presentation on theme: "How to Represent Numbers on a Computer"— Presentation transcript:

1 How to Represent Numbers on a Computer
Digital Data How to Represent Numbers on a Computer

2 Memory: One Bulb On=Yes Off=No
Memory is made up of two-state devices, like a light bulb. One bulb has two states. We could store two things (yes or no). On=Yes Off=No

3 Two bulbs, four states: Off, off: Off, on: On, off: On, on: No, no
No, yes Yes, no Yes, Yes

4 Three bulbs, eight states:
Off, off, off Off, off, on Off, on, off Off, on, on On, off, off On, off, on On, on, off On, on, on

5 Four bulbs, 16 states:

6 Pretend they are numbers, where off=0 and on=1:
0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111

7 How do we interpret the numbers?
Base 10 numbers: 10 digits: 0 through 9 Place value is based on powers of 10 ___ ___ ___ ___ ___ ___ 100, , ,

8 Base 10 100, , , So 123,456 = 1 * 100,000 = 100,000 2 * 10,000 = ,000 3 * 1,000 = ,000 4 * 100 = 5 * 10 = 6 * 1 = 123,456

9 With 2 digits: Base 2 number system: __ __ __ __ __ __ __ __
2 digits: 0 through 1 Place value is based on powers of 2 __ __ __ __ __ __ __ __

10 Base 2 __ __ __ __ __ __ __ __ So = 1 * 128 = * 64 = 0 1 * 32 = 32 0 * 16 = 0 1 * 8 = 8 0 * 4 = 0 1 * 2 = 2 0 * 1 = 0 170

11 The first 8 binary numbers (with leading zeros)
0000= = = = = = = = = = = = = = = = 7

12 Binary numbers are represented in BYTES – groups of 8 bits
Byte: a group of 8 bits. The basic unit of storage on most computers. 0 = = = = = = = =

13 Some other binary numbers
= = = = = = = 255

14 Need numbers greater than 255?
Use two bytes: Smallest number = Biggest number = = , ,768 = 65,535

15 Need numbers greater than 65,535?
Use 4 bytes: Smallest number: Biggest number: = 4,294,967,295

16 Other numbers There are also ways to represent:
Decimal fractions Negative numbers These will be covered elsewhere.

17 The End


Download ppt "How to Represent Numbers on a Computer"

Similar presentations


Ads by Google