1 / 21

Lecture 5 Number System

Lecture 5 Number System. CSCS100 - Fall 2007 – Forman Christian College Asher Imtiaz Wajeeha Akram. *Several of these slides have been adapted and modified from LUMS CS101 course (Dr Salim Tariq), VU CS101 slides (Dr. Altaf A. Khan) and Peter Norton’s supplementary material.

meris
Download Presentation

Lecture 5 Number System

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. Lecture 5Number System CSCS100 - Fall 2007 – Forman Christian College Asher Imtiaz Wajeeha Akram *Several of these slides have been adapted and modified from LUMS CS101 course (Dr Salim Tariq), VU CS101 slides (Dr. Altaf A. Khan) and Peter Norton’s supplementary material.

  2. “There are 10 kinds of people in the world: those who understand binary and those who don't.” Ben Hammond

  3. Goals • To become familiar with the number system used by the microprocessors • Binary Numbers • Decimal to Binary Conversions

  4. How Computers Represent Data • Number systems • A manner of counting • Several different number systems exist • Decimal number system • Used by humans to count • Contains ten distinct digits • Digits combine to make larger numbers

  5. How Computers Represent Data • Bits and bytes • Binary numbers are made of bits • Bit represents a switch • A byte is 8 bits • Byte represents one character

  6. Number Systems • Decimal System • Base 10 • Binary System • Base 2 • Octal System • Base 8 • Hexadecimal System • Base 16

  7. Decimal Number System • Base 10 system (Ten digits: 0, 1, 2, …, 9) • Counting process • Every digit goes through a cycle 0  9 • After a complete cycle of a lower significant digit (0 through 9) immediately higher digit is incremented by 1, while the lower significant digit is reset to 0. • 012…91011…192021 and so on

  8. Decimal Number System • Expanded form • 5429 = 5,000 + 400 + 20 + 9 OR • 5,429 = 5x103 + 4x102 + 2x101 + 9x100 • Addition • Carry • Subtraction • Borrow • Negative number

  9. Binary Number System • Base 2 system (2 digits; 0, 1) • Counting 0,1,10,11,100,101,110,111,1000,…

  10. Binary Number System Expanded form • (110010)2 = 1x25 + 1x24 + 1x21 = 32 + 16 + 2 = (50)10 • (1110)2 = 8+4+2=(14)10

  11. Binary Number System N zeros

  12. Decimal & Binary conversion • Convert (289)10 into binary • Convert (10111010)2 into decimal

  13. Hexadecimal Number System • Base 16 system (0,1,…,9,A,B,…F digits) • A  (10) 10 • F  (15)10 • Counting • 0,1,2,…,A,B,…,E,F,10,11,…1E,1F,20,… • Decimal Equivalents • (10)16 = (1 x 161) + (0 x 160) = (16)10 • (F2)16 = (15 x 161) + (2 x 160) = (242)10

  14. Hexadecimal Number System • Hexadecimal & decimal conversions • (462)10 (?)16 • (462)16 (?)10

  15. Hexadecimal Number System • Binary & Hexadecimal Conversions • Combine 4 binary digits into a hexadecimal number • Break each hexadecimal digit into 4 binary digits

  16. Hexadecimal& Binary Conversion 8 4 2 1

  17. Hexadecimal& Binary Conversion

  18. Power of 2 • Inventor of chess • All that he asked was to place one grain of rice on the first box and keep on doubling • Money Game • I will give you Rs 100,000 everyday for 30 days. You will give me 1 paisa on the 1st day but will double the amount every day for 30 days. • 230-1 ~ 10.7 x 108

  19. Base 16 (Hexadecimal) • (100)10 = (64)16= 6*16 + 4*1 100 • |6 – 4 Repeatedly divide by 16, until you get a number less than 16. (1000)10 = (3E8)16 = 3*16*16 + 14*16 + 8*1 1000 A-10, B-11, C-12 16 |62 – 8 D-13, E-14, F-15 16 |3 - 14

  20. Text Codes Table 5A.3

  21. Maximum Number in n-bits • 2 bits, max number is 11 (3) • 3 bits, max number is 111 (7) • 8 bits, max number is 11111111 (255) • n bits, max number is ???

More Related