03-NumberSystems.pptx - ICS 212 Program Structure William McDaniel Albritton M.S Memory Allocation Numeric Systems Decimal Binary Hexadecimal Converting

03-NumberSystems.pptx - ICS 212 Program Structure William...

This preview shows page 1 - 17 out of 47 pages.

ICS 212 Program Structure William McDaniel Albritton M.S.
Image of page 1
Memory Allocation Numeric Systems Decimal, Binary, Hexadecimal Converting Integer Representation Character Representation
Image of page 2
Image of page 3
Numeric Systems
Image of page 4
Decimal (base 10) Uses positional representation Each digit corresponds to a power of 10 based on its position in the number The powers of 10 increment from 0, 1, 2, etc. as you move right to left 1,479 = 1 * 10 3 + 4 * 10 2 + 7 * 10 1 + 9 * 10 0
Image of page 5
Binary (base 2) Two digits: 0, 1 To make the binary numbers more readable, the digits are often put in groups of 4 1010 = 1 * 2 3 + 0 * 2 2 + 1 * 2 1 + 0 * 2 0 = 8 + 2 = 10 decimal 1100 1001 = 1 * 2 7 + 1 * 2 6 + 1 * 2 3 + 1 * 2 0 = 128 + 64 + 8 + 1 = 201 decimal
Image of page 6
Shorter and easier to read than binary 16 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F “0x” often precedes hexadecimal numbers 0x123 = 1 * 16 2 + 2 * 16 1 + 3 * 16 0 = 1 * 256 + 2 * 16 + 3 * 1 = 256 + 32 + 3 = 291 decimal Hexadecimal (base 16)
Image of page 7
Hexadecimal (base 16) Another example 0xABC = A * 16 2 + B * 16 1 + C * 16 0 = 10 * 256 + 11 * 16 + 12 * 1 = 2560 + 176 + 12 = 2748 decimal
Image of page 8
0000 0 0 0001 1 1 0010 2 2 0011 3 3 0100 4 4 0101 5 5 0110 6 6 0111 7 7 Binar y Decim al Hexadeci mal
Image of page 9
1000 8 8 1001 9 9 1010 10 A 1011 11 B 1100 12 C 1101 13 D 1110 14 E 1111 15 F 10000 16 10 Binar y Decim al Hexadeci mal
Image of page 10
Converting From binary or hex to decimal Use positional representation as shown previously From decimal to binary (or hex) Keep dividing by 2 (or 16) Remainders give the digits, starting from lowest power
Image of page 11
Converting From binary to hex (or vice versa) Replace each set of four binary digits by the corresponding hexadecimal digit (or vice versa)
Image of page 12
Convert Decimal to Binary 22 decimal = 10110 binary Calculations: 2 |22 r. 0 2 |11 r. 1 2 | 5 r. 1 2 | 2 r. 0 2 | 1 r. 1 0
Image of page 13
Convert Decimal to Binary 22 decimal = 10110 binary Calculations: Write down powers of 2 Subtract the largest power of 2 that is less than the number Add a 1 if can subtract, and a 0 if cannot 22 6 2 32 16 8 4 2 1 0 1 0 1 1 0
Image of page 14
Other Bases Base 8 (octal number system) 123 = 1 * 8 2 + 2 * 8 1 + 3 * 8 0 = 1 * 64 + 2 * 8 + 3 * 1 = 64 + 16 + 3 = 83 decimal
Image of page 15
Other Bases
Image of page 16
Image of page 17

You've reached the end of your free preview.

Want to read all 47 pages?

  • Spring '18
  • Binary numeral system,  Shorter,  Keep,  Remainders

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes