3.2 FIXED POINT ADDITION AND SUBTRACTION The addition of binary numbers and the concept of overﬂow were brieﬂy discussed in Chapter 2. Here, we cover addition and subtraction of both signed and unsigned ﬁxed point numbers in detail. Since the two’s complement representation of integers is almost universal in today’s computers, we will focus primarily on two’s complement operations. We will brieﬂy cover operations on 1’s complement and BCD numbers, which have a foundational signiﬁcance for other areas of computing, such as networking (for 1’s complement addition) and hand-held calculators (for BCD arithmetic.)

3.1 OVERVIEW In the previous chapter we explored a few ways that numbers can be represented in a digital computer, but we only brieﬂy touched upon arithmetic operations that can be performed on those numbers. In this chapter we cover four basic arithmetic operations: addition, subtraction, multiplication, and division. We begin by describing how these four operations can be performed on ﬁxed point numbers, and continue with a description of how these four operations can be performed on ﬂoating point numbers.

2.5 CHARACTER CODE Unlike real numbers, which have an inﬁnite range, there is only a ﬁnite number of characters. An entire character set can be represented with a small number of bits per character. Three of the most common character representations, ASCII, EBCDIC, and Unicode, are described here.

2.5.1 THE ASCII CHARACTER SET The American Standard Code for Information Interchange (ASCII) is summarized in Figure 2-13, using hexadecimal indices.

2.4 Case Study: Patriot Missile Defense Failure Caused by Loss of Precision During the 1991-1992 Operation Desert Storm conﬂict between Coalition forces and Iraq, the Coalition used a military base in Dhahran, Saudi Arabia that was protected by six U.S. Patriot Missile batteries. The Patriot system was originally designed to be mobile and to operate for only a few hours in order to avoid detection. The Patriot system tracks and intercepts certain types of objects, such as cruise missiles or Scud ballistic missiles, one of which hit a U.S. Army barracks at Dhahran on February 5, 1991, killing 28 Americans. The Patriot system failed to track and intercept the incoming Scud due to a loss of precision in converting integers to a ﬂoating point number representation.