1 / 15

How Computers Represent Numbers

How Computers Represent Numbers. Binary Representations. Binary Code. A series of 1’s and 0’s Place value is in powers of 2. The Decimal System. Analyze the number 2,473 2,473 = 2 * 1000 + 4 * 100 + 7 * 10 + 3 *1 2,473 = 2 * 10 3 + 4 * 10 2 + 7 * 10 1 + 3 * 10 0

fruma
Download Presentation

How Computers Represent Numbers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How Computers Represent Numbers Binary Representations

  2. Binary Code • A series of 1’s and 0’s • Place value is in powers of 2

  3. The Decimal System • Analyze the number 2,473 • 2,473 = 2 * 1000 + 4 * 100 + 7 * 10 + 3 *1 • 2,473 = 2 * 103 + 4 * 102 + 7 * 101 + 3 * 100 • Each position in a number represents a different power of 10 • Decimal is a base 10 system

  4. Binary as Base 2 • (1011001)2 = 1*26 + 0* 25 + 1* 24 + 1* 23 + 0* 22 + 0* 21 +1* 20 • (1011001)2 = 1*64 + 0*32 + 1*16 + 1*8 + 0*4 + 0*2 + 1*1 • (1011001)2 = 64 + 16 + 8 + 1 • (1011001)2 = 89 (decimal)

  5. Base 3 • (1011001)3 = 1*3^6 + 0*3^5 + 1*3^4 + 1*3^3 + 0*3^2 + 0*3^1 +1*3^0 • (1011001)3 = 1*729 + 0*243 + 1*81 + 1*27 + 0*9 + 0*3 + 1*1 • (1011001)3 = 729 + 81 + 27 + 1 • (1011001)3 = 838 (decimal)

  6. Exercise • Find the decimal equivalent of (1011001)2 • 100111 = 1*2^5 + 1*2^2 + 1*2^1 + 1*2^0 • 100111 = 1*32 + 1*4 + 1*2 + 1*1 • 100111 = 32 + 4 + 2 + 1 • 100111 = 39 (decimal)

  7. Hexadecimal System • Base-16 system • Needs digits 0 through 15 - we don’t have numbers for 10 - 15. • We use the letters A - F to represent the numbers 10 - 15.

  8. Exercise • What would 3B in hexadecimal be in decimal? • 3B = 3 * 16 ^ 1 + 11 * 16 ^ 0 • 3B = 3 * 16 + 11 * 1 • 3B = 48 + 11 • 3B = 59 (decimal)

  9. More on hexadecimal • 4 binary digits equal one hexadecimal number • 0101 (binary) = 5 (hex) • 1101 (binary) = D (hex) • 1011101 (binary) = 93 (decimal) = 5D (hex)

  10. Divide by 2 and keep track of the remainders. 39 (decimal) = 100111 (binary) Decimal to Binary

  11. Exercise • Convert 89 (decimal) to binary • 89 (decimal) = 1011001 (binary)

  12. Why use binary? • Binary uses more digits than decimal, so why do we use it? • Electronic hardware can either be ‘on’ or ‘off’ - nothing in between. • Binary fits this pattern - ‘on’ state is 1 in binary and ‘off’ state is 0 in binary.

  13. Numeric Representation of Letters and Digits • In a computer, letters and digits are represented by numeric codes. • Example Code: • What does this say? 8 9 3 12 1 19 19

  14. ASCII and EBCDIC • The 2 most common codes used in computers are ASCII (American Standard Code for Information Interchange) and EBCDIC (Extended Binary Coded Decimal Interchange Code). They provide codes for letters, digits, punctuation marks, and other special characters.

  15. 72-101-108-108-111-32-67-108-97-115-115-33

More Related