Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Microcontroller Programming. Thi Micro Chip PIC (Julio Sanchez, 2007).pdf
Скачиваний:
476
Добавлен:
12.08.2013
Размер:
4.99 Mб
Скачать

Chapter 2

Number Systems

In order to perform more efficient digital operations on numeric data, mathematicians have devised systems and structures that differ from those used traditionally. This chapter presents the background material necessary for understanding and using the number systems and numeric data storage structures employed in digital devices.

2.0 Counting

The fundamental application of a number system is counting. A stone-age hunter uses his or her fingers to show other members of the tribe how many mammoths were spotted at the bottom of the ravine. In this manner the hunter is able to transmit a unique type of information that does not relate to the species, size, or color of the animals, but to their numbers. Our minds have the ability to capture this notion of "oneness" independently from other properties of objects.

The most primitive method of counting consists of using objects to represent degrees of oneness. The stone-age hunter uses fingers to represent individual mammoth. Alternatively, the hunter could have resorted to pebbles, sticks, lines on the ground, or scratches on the cave wall to show how many units there were of the object.

2.0.1 The Tally System

The tally system probably originated from notches on a stick or scratches on a cave wall. In its simplest form each scratch, notch, or line represents an object. The method is so simple and intuitive that we still resort to it occasionally. Tallying requires no knowledge of quantity and no elaborate symbols. Had there been 12 mammoth in the ravine the cave wall would have appeared as follows:

||||||||||||

A logical evolution of the tally system consists of grouping the marks. Since we have five fingers in each hand, the 12 mammoth may have been grouped as follows:

||||| ||||| ||

19

20

Chapter 2

Perhaps a primitive mathematical genius added one final sophistication to the tally system. By drawing one tally line diagonally the visualization is further improved, as in this familiar style:

2.0.2 Roman Numerals

Roman numerals show how a simple graphical tally system evolved into a symbolic numeric representation. The first five digits were encoded with the symbols:

I, II, III, IIII, and V

The Roman symbol V is conceivably a simplification of the tally encoding using a diagonal line to complete the grouping.

Table 2.1

Symbols in the Roman Numeration System

ROMAN

DECIMAL

 

 

I

1

V

5

X

10

L

50

C

100

D

500

M

1000

The Roman numeral system is based on an add-subtract rule whereby the elements of a number, read left-to-right, are either added or subtracted to the previous sum according to its value. Thereby the decimal number 1994 is represented in Roman numerals as follows:

MCMXCIV = M + (C - M) + (X - C) + (I - V)

=1000 + (1000 - 100) + (100 - 10) + (5 - 1)

=1000 + 900 + 90 + 4

=1994

The uncertainty in the positional value of each digit, the absence of a symbol for zero, and the fact that some numbers require either one or two symbols (I, IV, V, IX, and X) complicate the rules of arithmetic using Roman numerals.

2.1 The Origins of the Decimal System

The one element of our civilization which has transcended all cultural and social differences is our decimal system of numbers. While mankind is yet to agree on the most desirable political order, on generally acceptable rules of moral behavior, or on a universal language, the Hindu-Arabic numerals have been adopted by practically all the nations and cultures of the world.

Number Systems

21

By the 9th century A.D. the Arabs were using a ten-symbol positional system of numbers which included the special symbol for 0. The Latin title of the first book on the subject of "Indian numbers" is Liber Algorismi de Numero Indorum. The author is the Arab mathematician al-Khowarizmi.

In spite of the evident advantages of this number system its adoption in Europe took place only after considerable debate and controversy. Many scholars of the time still considered Roman numerals to be easier to learn and more convenient for operations on the abacus. The supporters of the Roman numeral system, called abacists, engaged in intellectual combat with the algorists, who were in favor of the Hindu-Arabic numerals as described by al-Khowarizmi. For several centuries abacists and algorists debated about the advantages of their systems, with the Catholic church often siding with the abacists. This controversy explains why the Hindu-Arabic numerals were not accepted into general use in Europe until the beginning of the 16th century.

It is sometimes said that the reason for there being ten symbols in the Hindu-Arabic numerals is related to the fact that we have ten fingers. However, if we make a one-to-one correlation between the Hindu-Arabic numerals and our fingers, we find that the last finger must be represented by a combination of two symbols, 10. Also, one Hindu-Arabic symbol, 0, cannot be matched to an individual finger. In fact, the decimal system of numbers, as used in a positional notation that includes a zero digit, is a refined and abstract scheme which should be considered one of the greatest achievements of human intelligence. We will never know for certain if the Hindu-Arabic numerals are related to the fact that we have ten fingers, but its profoundness and usefulness clearly transcends this biological fact.

The most significant feature of the Hindu-Arabic numerals is the presence of a special symbol, 0, which by itself represents no quantity. Nevertheless, the special symbol 0 is combined with the other ones. In this manner the nine other symbols are reused to represent larger quantities. Another characteristic of decimal numbers is that the value of each digit depends on its position in a digit string. This positional characteristic, in conjunction with the use of the special symbol 0 as a placeholder, allows the following representations:

1 = one

10 = ten

100 = hundred

1000 = thousand

The result is a counting scheme where the value of each symbol is determined by its column position. This positional feature requires the use of the special symbol, 0, which does not correspond to any unit-amount, but is used as a place-holder in multicolumn representations. We must marvel at the intelligence, capability for abstraction, and even the sense of humor of the mind that conceived a counting system that has a symbol that represents nothing. We must also wonder about the evolution of mathematics, science, and technology had this system not been invented. One intriguing question is whether a positional counting system that includes the zero symbol is a natural and predictable step in the evolution of our mathematical

22

Chapter 2

thought, or whether its invention was a stroke of genius that could have been missed for the next two thousand years.

2.1.1 Number Systems for Digital-Electronics

The computers built in the United States during the early 1940s operated on decimal numbers. However, in 1946, von Neumann, Burks, and Goldstine published a trend-setting paper titled Preliminary Discussion of the Logical Design of an Electronic Computing Instrument, in which they state:

"In a discussion of the arithmetic organs of a computing machine one is naturally led to a consideration of the number system to be adopted. In spite of the long-standing tradition of building digital machines in the decimal system, we must feel strongly in favor of the binary system for our device."

In their paper, von Neumann, Burks, and Goldstine also consider the possibility of a computing device that uses binary-coded decimal numbers. However, the idea is discarded in favor of a pure binary encoding. The argument is that binary numbers are more compact than binary-coded decimals. Later in this book you will see that binary-coded decimal numbers (called BCD) are used today in some types of computer calculations.

In 1941, Konrad Zuse, a German who had done pioneering work in computing machines, released the first programmable computer designed to solve complex engineering equations. The machine, called the Z3, was controlled by perforated strips of discarded movie film and used the binary number system.

The use of the binary number system in digital calculators and computers was made possible by previous research on number systems and on numerical representations, starting with an article by G.W. Leibnitz published in Paris in 1703. Researchers concluded that it is possible to count and perform arithmetic operations using any set of symbols as long as the set contains at least two symbols, one of which must be zero.

In digital electronics the binary symbol 1 is equated with the electronic state ON, and the binary symbol 0 with the state OFF. The two symbols of the binary system can also represent conducting and nonconducting states, positive or negative, or any other bi-valued condition. It was the binary system that presented the Hindu-Arabic decimal number system with the first challenge in 800 years. In digi- tal-electronics two steady states are easier to implement and more reliable than a ten-digit encoding.

2.1.2 Positional Characteristics

All modern number systems, including decimal, hexadecimal, and binary, are positional and include the digit zero. It is the positional feature that is used to determine the total value of a multi-digit representation. For example, the digits in the decimal number 4359 have the following positional weights: