Number representations

Nasza ocena:

3
Wyświetleń: 728
Komentarze: 0
Notatek.pl

Pobierz ten dokument za darmo

Podgląd dokumentu
Number representations - strona 1 Number representations - strona 2

Fragment notatki:

Number representations So far only positive numbers were presented. As in decimal, also in other systems we have to
present both positive (represented with “+” sign) and negative (represented with “-“ sign) values.
This notation is called sign magnitude. Computers are generally not designed to interpret a plus
or minus sign, so often the most significant bit is reserved for sign (0 means “+”, 1 means “-“).
During most operations computer circuits must first check sign bits of arguments and (according
to their values) perform appropriate operations.
Positive and negative numbers can also be expressed by two other number representations.
These are the diminished radix complement (DRC) or (r-1)'s complement representation, and
radix complement (RC) or r's complement representation.
The (r-1)'s complement of a number N is defined by the relationship, ri-r-f-N, where N is the
number to be negated, r is the radix, i is the number of integer digits, and f is the number of
fractional digits.
To obtain 1's complement of a binary number N, simply complement each digit of the number.
The r's complement of a number N is defined by the relationship ri-N, where N is the number to be
negated, r is the radix, i is the number of integer digits, and f is the number of fractional digits.
To obtain 2's complement of a binary number N, simply first obtain 1's complement of N and then
add 1 at the least significant bit.
Notice that positive numbers in all representations presented above are expressed in the same
way.
Example (r=2):
Let (A)2=(11010011.01101)2
then we should use at least 9 positions for integer and 5 positions for fraction, so
(A)2=(011010011.01101)2
1. Using sign-magnitude representation: (-A)2=(111010011.01101)2
2. Using 1's complement representation: (-A)2=(100101100.10010)2
3. Using 2s complement representation: (-A)2=(100101100.10011)2
To convert negative numbers into positive, one should perform exactly the same operation as
above.
... zobacz całą notatkę



Komentarze użytkowników (0)

Zaloguj się, aby dodać komentarz