Information Technology Reference
In-Depth Information
Today, most computers with fixedstorage allocation allow integers
to be at least 32 bits. Thus, integers can range from 0 to 4,294,967,295
( 2 32 1) or from 2,147,483,648 to 2,147,483,647. In practice, this
amount of storage is adequate for many applications.
The storage of real numbers (e.g., decimals) is somewhat more
challenging. Conceptually, we can add a period (which for a binary
number is called a radix point or binary point, rather than a deci
mal point), with subsequent digits representing powers of two with
negative exponents. That is, digits to the left of the binary point are
labeled with nonnegative powers of two, whereas digits to the right
are labeled with negative powers. As before, I'll illustrate the idea
with an example.
Example: Determine the Decimal Value of the Binary Number 100.1101
Again, we label each digit with a power of 2:
8bit number:
1
0
0
.
1
1
0
1
↑↑↑↑↑↑↑↑
Label:
4
2
1
point
1 2
1 4
1 8
1 16
2 2
2 1
2 0
2 1
2 2
2 3
2 4
(or power of 2):
Number's value:
4
1 2
1 4
1 16
or
4
8 16
4 16
1 16
or
4 13 16
Because 13 16 may be written as the decimal 0.8125, we conclude that the
binary number 100.1101 corresponds to the decimal number 4.8125.
Although such data conversions may be tedious, with adequate
practice and a table of powers of two for consultation, they become
fairly easy (see the endofchapter exercises for practice). Simply con
verting these numbers to binary, however, does not completely resolve
the question of how real numbers should be stored within a computer.
The difficulty centers on knowing how many digits to allow both be
fore the binary point and after. For example, sometimes we may want
to store extremely large numbers (e.g., 2 20 ), whereas other times an ap
plication may require many very small numbers (e.g., 2 20 ). As a com
Search WWH ::




Custom Search