1 / 8

Binary Numbers

Binary Numbers. Numbers In Memory.

kareem
Download Presentation

Binary 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. Binary Numbers

  2. Numbers In Memory • All information in a computer is stored and managed as binary numbers. Unlike the decimal system, which has 10 digits (0-9) and is based upon powers of 10, the binary system has only 2 digits (0 and 1) and is based upon powers of 2. A single binary digit is called a bit, and 8 bits = 1 byte.

  3. Numbers In Memory HOW??? Decimal Number: 32 = Binary Equivalent: 100000 In base 2 (binary), we have 1 32’s and 0 of the places below it =100000 In base 10 (decimal), we have 3 10’s and 2 1’s = 32

  4. Numbers In Memory • In your computer, integers are represented in binary (base 2) 0 0 1 1 2 10 3 11 ... ... 255 1111 1111 • C++ uses 4 bytes (32 bits) for an integer: 17 0000 0000 0000 0000 0000 0000 0001 0001 16 + 1 Each digit is a single bit

  5. Numbers In Memory Convert 43 from decimal notation to binary. 25 = 32 is the highest power needed. • Example 1 23 = 8 (don’t add 24 b/c too big!) 21 = 2 (don’t add 22 b/c too big!) + 20 = 1 No 24 and no 22 10 1011 = 43 43 0000 0000 0000 0000 0000 0000 0010 1011 Leading zeros can be left off

  6. Numbers In Memory Convert 1101 from binary to decimal notation. 0000 0000 0000 0000 0000 0000 0000 1101 ?? • Example 2 23,22, no 21 and a20 23 + 22 + 20 8 + 4 + 1 1101 = 13 13 Leading zeros are left off

  7. Numbers In Memory Convert 127 from decimal notation to binary. 26 = 64 is the highest power needed • Example 3 25 = 32 What do you think 128 is in binary? 24 = 16 23 = 8 22 = 4 21 = 2 + 20 = 1 111 1111 = 127

  8. Practice: Answers: • Convert these base 10 numbers to binary: 23 45 892 1 0111 10 1101 11 0111 1100 • Convert these binary numbers to base 10: 10 1100 111 0000 1 Answers: 112 1 44 • Convert 1 1101 binary to base 4: Answer: 131

More Related