Number Systems

Tom Kelliher, CS 220

Sept. 5, 2003

Administrivia

Announcements

Assignment

Read 1.3 of Mano.

Outline

  1. Number systems: decimal, binary, hexadecimal.

  2. Number ranges.

Coming Up

Base conversion and character representation.

Number Systems

Positional, weighted number systems. Example of a non-weighted number system: Roman numerals. Example of non-positional non-weighted number system: unary.

Radix, digit set.

Decimal Numbers

  1. Radix 10, digit set 0--9.

  2. .

    Radix point.

  3. General case:

    We can substitute any radix and digit set we want.

Binary Numbers

  1. Radix 2, digit set: 0, 1.

  2. Decimal values of , , and ?

    Binary point

  3. Powers of two. K, M, and G.

Hexadecimal Numbers

(Octal is similar --- study on your own.)

  1. Radix 16, digit set: 0--9, A--F.

  2. Generally used as compact binary form.

    How? --- Powers of two.

  3. C Constants: 0XFE23, 0x89ab. (0567).

  4. Relationship to binary and decimal.

    .

Number Ranges

  1. Range of values which can be represented.

    Meaning of unsigned.

  2. Consider an n-bit number. How many values can be represented? What is the range of values for an n-bit unsigned number?

  3. What is the range of values of an 8-bit unsigned number?

Exercises

Convert the following binary numbers to hexadecimal and decimal:

  1. 11100111

  2. 00111010

  3. 11000111

  4. 00011111

  5. 11101110



Thomas P. Kelliher
Wed Sep 3 11:07:49 EDT 2003
Tom Kelliher