Computer Representation of Data

Groups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0, ...

P#1: How many combinations can be represented by a group of three of these two-state devices?

P#2: Give a general formula for the number of combinations of a group of N of these two-state devices.

We will assume that the memory cell size is 8-bits for the purposes of discussion. You should be able to apply the concepts to memory cell sizes of n-bits.

Unsigned Numbers (Modulo 2^n)

Q#1: How many different unsigned numbers can be represented in 8-bits?

P#1: Let's write out the first 3 unsigned integers and the last 2 under the following column headings.

Bit Pattern     Modulo(2^8) Integer
-----------     -------------------


It is important to note that the Intel processors use the modulo 2^n number system to represent unsigned integers. It is also important to know that in C++ when an integer is declared as say: unsigned int x; that x is represented in modulo 2^n representation.

Q#2: How many bytes are allocated to an unsigned int in C++?

Signed Numbers

Signed Magnitude

Signed magnitude numbers provide for both positive and negative integers. The leftmost bit (MSB - most significant bit) is the sign bit. A zero signifies a positive integer and a one signifies a negative integer. For example, 00001111 represents a +15 and 10001111 represents a -15.

Q#1: What is the range of integers that can be represented in 8-bits?

Q#2: What is the general formula for this range using N-bits?

Q#3: How many representations of zero exist?

Q#4: What is the representation of 127.

Q#5: If we add one to the value in Q#4, what do we end up with?

P#1: Fill in the table (first 2 & last 2 ) below:

Bit Pattern     Signed Magnitude   
-----------     ----------------


One's Complement

One's complement numbers provide for both positive and negative integers. The MSB is the sign bit. A zero signifies a positive integer and a one signifies a negative integer. For example, 00001111 represents a +15 and but 10001111 does not represent a -15. How do we find out what 10001111 represents? The answer is that we invert the bits, add up the positional values of each bit, and put a negative sign in front of the number.

Q#1: What is the range of integers that can be represented in 8-bits?

Q#2: What is the general formula for this range using N-bits?

Q#3: How many representations of zero exist?

Q#4: What is the representation of 127.

Q#5: If we add one to the value in Q#4, what do we end up with?

P#1: Fill in the table (first 2 & last 2 ) below:

Bit Pattern     One's Complement     
-----------     ----------------


Two's Complement

Two's complement numbers provide for both positive and negative integers. The MSB is the sign bit. A zero signifies a positive integer and a one signifies a negative integer. For example, 00001111 represents a +15 and but 10001111 does not represent a -15. In order to find out what this bit pattern represents, take the one's complement and add 1. Sum up the bits and convert to decimal. Finally, place a negative sign in front of the number. So what decimal number does the two's complement number 10001111 represent?

Q#1: What is the range of integers that can be represented in 8-bits?

Q#2: What is the general formula for this range using N-bits?

Q#3: How many representations of zero exist?

Q#4: What is the representation of 127.

Q#5: If we add one to the value in Q#4, what do we end up with?

P#1: Fill in the table (first 2 & last 2 ) below:

Bit Pattern     Two's Complement 
-----------     ----------------


ASCII Data

The final representation of data is ASCII (American Standard Code for Information Interchange) which is a 7-bit code. With 7-bits a total of 128 characters can be represented.

The first 32 binary codes represent control characters and are unprintable. The remaining are printable characters such as A or ! and so on. For the IBM PC, the code has been extended to an 8-bit code in which case the first 128 codes are the standard ASCII characters and the remaining 128 codes are an extended ASCII character set to include a variety of symbols to include graphics and the like.

Some Boolean Algebra and Truth Tables

Let's review pp. 26-27 with regard to boolean operators and expressions.


©Douglas J. Ryan/ryandj@pacificu.edu