### Module 4 Section 1- Significance

Floating point numbers are used to represent numbers which:

• Are too large to be represented as binary integers. This occurs when the number requires more bits than we can or will provide to store it in.
• Are fractional. This occurs when we want to store numbers between the integers, such as 1/2, or 3.456.

Consider a very large number, such as 4,567,390. What if you only were allowed to use 4 decimal places to represent this number? You really need 7 places, but you can only have 4. Which places will you choose to keep? Which will you throw away? The most important thing about a number is its magnitude. When we are forced to drop digits because we have no room to store them, we will always drop the least significant ones and keep the most significant ones. So, for 4,567,390 we will keep the '4,567' and throw away the ',390'. We must remember, however, that this number is '4 million 567 thousand' rather than '4 thousand 567.' So we can write our original number like this:

4,567,000

This will require us to keep an additional number, which is the power of ten to be multiplied by the 4 digits we chose to remember. Using this scheme we are able to store large numbers in small spaces. The price is precision.. We have truncated 4,567,390 to 4,567,000. By throwing away the '390' we have reduced the precision of the number, but kept the most important information, given the amount of space we are allowed to use to store it. A truncated number is also known as an "approximate" representation of the actual number.

Not all of the digits we write in a number are significant. In the above number (4,567,000) we know that only the first four digits are significant because we are the ones that chopped off the 390. But consider the number:

8,400

How many digits are significant in this number? Certainly the '8' and the '4' are significant. In fact, all non-zero digits are significant. But what about the last two 0's? If this is exactly the number '8,400' then all four digits are significant. However, if this number was originally '8,425' and it has been trunctated to fit into 2 digits, then the last two digits are not significant. This is an ambiguous representation for this number, since we don't know whether the trailing zeros are significant. We will have to deal with the ambiguity problem shortly.

You can't always throw away 0's. Consider

70,001

The three 0's in the middle are important because they separate the '7' from the '1', and the '1' does contribute to the accuracy of the number. Zeros are significant when they appear between other significant digits.

Consider the number 00,780. The two leading zeros contribute no information to the number. In fact, we can write any number with as many leading zeros as we wish and it will never make any difference. Therefore, leading zeros (zeros that come before all the other significant digits) are never significant, even if they are after a decimal point.

Speaking of decimal points, adding decimal points can make things confusing. Consider the number

3.40

You may first think that only the '3' and the '4' are significant. However, the fact that the '0' appears may be important. It could be saying 'We measured this number to the nearest hundredth, and it just happens to be 0.' In this case, the accuracy of the number (that it was measured to the nearest hundredth) is significant, and the 0 is significant. So, trailing zeros that appear after an embedded decimal point and other significant digits are also significant.

So, given a number, here are the rules for determining which digits are significant:

1. A nonzero digit is always significant
2. The digit '0' is significant if it lies between other significant digits
3. The digit '0' is never significant if it precedes all the nonzero digits, even if it follows an embedded decimal point
4. The digit '0' is significant if it follows an embedded decimal point and other significant digits

Here are several examples of numbers, with the significant digits underlined:

1. 807003
2. 032.00 - the zeros are significant because they follow an embedded decimal point and other significant digits
3. 40.020
4. 500 - in this case, the trailing zeros may or may not be significant
5. 0.0023 - in this case, even though zeros appear after the decimal point, the are insignificant by rule #3

The ambiguous cases are difficult to work with, so we need a way to write numbers which leaves no room for doubt about which digits are and are not significant. This can be accomplished by writing the number in two parts.  The first part is the signficant digits, and the second part is the power of the base to multiply by. So, if we take '4,567,390' and truncate it to 4 digits, we would write it as:

4,567 x 103

This format, known as exponential form, shows us that there are 4 significant digits, but that this number is 4,567,000. Exponential form just breaks the number down into two parts:

1. The mantissa (also known as the significand) These are the significant digits. In the example above, the mantissa is 4,567
2. The exponent This is the power to which the base should be raised before being multiplied by the mantissa. In the example above, the exponent is 3 (not 103).

There are several possible exponential form representations of the same number which vary in where the decimal point is placed, which determines the exponent value. For example, the above number could also have been written as any of the following (two of which are special forms):

456.7 x 104
45.67 x 105
4.567 x 106
- scientific notation
.4567 x 107 - normalized exponential form

Although these are equivalent representations, for practical purposes we should choose a normalized form. A normalized form is one where the decimal point is forced to a particular position. There are two normalized forms in use. One, simply called normalized exponential form forces the decimal point to the left of the most significant digit. Another, which we will use, is called scientific notatation, in which the decimal point is forced to go to the right of the most significant digit.

All of what we have learned about precision of decimal numbers applies to binary numbers, too. Consider the binary number 01001011. If you were only allowed 4 bits of precision, how would you represent this number. First, you would isolate the significant bits, which would be 01001011. Next, you would keep the first four significant digits and throw away the rest. So, this number becomes 1001000 which could be written in scientific notation as:

1.001 x 10110

Remember that this is all written in binary, so the above would be read "one point oh oh one times two to the sixth." Here's another example: 0.001011011 stored in 6 bits. The six most significant bits are 0.001011011. Written in scientific notation:

1.01101 x 10-11

Remember, that's two raised to the minus third power!

### Homework Questions

Underline the significant digits in the following decimal numbers
1. 603
2. 080
3. 74.5640
4. 037.1
5. 0.002

Underline the significant bits in the following binary numbers
6. 00010101.011101
7. 1001.0110
8. 01001100
9. 0.00101
10. 01101.011

Write each of the following decimal numbers in both scientific and normalized exponential forms if the precision is a) 4 digits, and b) 6 digits.
11. 6,000,324,248
12. 70,299.022023
13. 0.021
14. 0
15. 8,232,940,000,010

Write each of the following binary numbers in both scientific and normalized exponential forms if the precision is a) 4 bits, and b) 8 bits
16. 01011.01011
17. 101.01
18. 10010111010111
19. 001001010.011
20. 010.01

Previous Module: Computer Integer Arithmetic
Next Section: Floating-point Representation