What
components are needed for real numbers?
Just
as there are an infinite number of integers (from -∞ to +∞) there are are an
infinite number of real numbers. However, what makes real numbers more complex
is that between any two real numbers, there are an additional number of real
numbers.
What ???
Let's take an example.
Between the integers 1 and 2, there are no other integers. However, between the
real numbers 1.0 and 2.0, there are an infinite number of real numbers:
1.01, 1.001, 1.0001,
1.00001, and so forth.
As
we saw in the previous tutorials, with integers we needed to keep track two
components:
The
sign and the value
The sign, as we saw, was
an easy matter to deal with: we needed only to allocate 1-bit as a sign bit.
Real numbers also require 1-bit to represent the sign (as a matter of fact,
there are no such things as unsigned real numbers, as there are with integers).
With real numbers there
are two additional problems to deal with.
-
Precision.
How precisely can we represent a real number?
For example, are we satisfied with representing pi as the value 3.14,
or do we need to represent is as 3.1415926535897932384626433832795
???
By now, we should realize the more precisely we wish to represent a number,
the bits we will need to allocate to it. Notice, we can represent a real
with number with exact precision, because between the number
3.14159265358979 (for example) and 3.141592653589793 there are an infinite
number of values (we will never have an infinite number of bits available).
-
Magnitude. How
large do we want our numbers to be?
This is a slightly different problem than the one we noted above (although
the operational problems are similar).
For example, The diameter of our galaxy, the Milky way, is
approximately 100,000 light years.
Light can travel approximately 186,282 miles in one second. A light
year is the distance that light travels in one year, or 5,880,000,000,000
miles. Therefore, our galaxy is a approximately:
100,000 * 5,880,000,000,000 =
5,880,000,000,000,000,000 miles in diameter.
This is a very large number, and as we know, would require a lot of bits to
represent as an integer (about
52).
Notice, however, that this is slightly different than precision. In this
case, we want to be able to represent very large numbers, but are willing to
give up some precision. We are willing to say:
Approximately:
5,880,000,000,000,000,000 miles, versus
Exactly:
5,879,789,012,890,361,045 Miles
As with our dilemma about precision, we will never be able to represent
extremely large numbers (say, the number of atoms in the universe) since we
will never have enough bits.
How do we capture these components ???
Let's take a look at a
decimal value, and see how we can rewrite it so that all three components are
clearly defined. The real value:
- 564.678
= - 56.4678 * 10 = - 56.4678 * 101 =
- 56.4678 E +1
= - 5.64678 * 100 = -
5.64678 * 102 = - 5.64678
E +2
= - .564678 * 1000 = -
.564678 * 103 = - .564678
E +3
I don't see how this helps!!
Essentially, we have
normalized the value into our three components of concern:
-
-
Our sign bit (we already know how this will be dealt with)
-
.564678 (the
decimal point has been placed in front of the first
significant digit. This component will be used in our precision component.
-
E +3
where the +3 tells us the direction and number of places we must move
the decimal point. This component will be used in our magnitude component.
I still don't get it!!
Patience. We are going to
further discuss precision and magnitude in our next tutorials.
This page was last updated on
05/31/05.
|