Given 16 bits (binary digits, in short), let's figure out the total
number of values that can be represented. The quick way is to find out
the largest number that can be represented as a 16-bit number. This is
rather easy: 1111 1111 1111 1111(2)
is the largest binary
number with 16 digits. Its hexadecimal representation is ffff(16)
,
and its decimal representation is 65535
.
So there are 65535 distinct values that can be represented by a 16-bit number, right?
Close. Although 65535 is the largest value that can be represented by an unsigned binary 16-bit integer, there is a total of 65536 values that can be represented. We missed zero (0)!
Given bits, we can represent
distinct values, and the maximum
unsigned value is
. Now, let's figure out whether a
32-bit integer can represent the U.S. deficit in dollars.
Copyright © 2006-08-21 by Tak Auyeung