polska03 wrote:
1) 10111 is a 5bit pattern that is express is excess-16 notation. What is the decimal number?
so i went 1x16^4 + 1x16^2 + 1x16^1=65809, but the answer is 7.
Excess-
16
notaton means that a numbers should be represented by the bit pattern equivalent to such number
plus 16
. So, using
7
as input, you have
16+7 = 23 = 10111b
(2^4+2^2+2^1+2^0)
polska03 wrote:
2) Convert 193(decimal) to a 10-but pattern using 2
s compliment notation/
Since
193
is positive, you haven't to complement (just use
193
binary representation)
193 = 0011000001b
(2^7+2^6+2^0)
polska03 wrote:
3)convert 3.4375(decimal) to an 8-bit floating point binarty patter that uses 1 bit for the sign, 3 bits for the exponent(excess-4 notation), and 4 bits of rthe manitssa.
I had no idea how to this one.
The sign is
0
since we have a positive number:
sign = 0b
Usually there is an implicit leading
1
in the mantissa, as, for instance in
"IEEE 754 standard". I will follow such a convention. Hence your
4
bits mantissa is
1.mmmm
i.e. a number ranging from
1
(1.0000b) to
1.9375
(
1.1111b = 2^0+2^-1+2^-2+2^-3+2^-4
); We need to multiply such a range by
2
, to include the given number, (
2 < 3.4375 < 3.875
), hence the exponent must be
1
, that is
5
in
4
-excess notation:
exponent = 101b
now the mantissa, we have:
3.375 = 11.011b < 3.4375 < 3.5 = 11.100b
We've to pick one (they are at same distance from the given number). I choose
3.5=11.100b
, hence
mantissa = 1100b
The final result is the following eight bit number
01011100
(Hope it makes sense).
[
added]
polska03 wrote:
for number 3, my prof gave told us the answer was 0 110 1110
That (probably) means your professor doesn't use the '
implicit leading 1 in the mantissa' convention; this way your mantissa is
.mmmm
and we need an exponent of
2
(need to multiply the mantissa by
4
), that is
6
in excess-
4
notation
exponent = 6 = 110b
so that
11.01b = 3.250 < 3.4375 < 3.500 = 11.10b
choosing
11.10
as best match, we obtain
01101110
[/
added]
:)