Click here to Skip to main content
14,541,538 members
Rate this:
Please Sign up or sign in to vote.
See more:
I got these 3 questions wrong on my exam and I am wondering how to do them.

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.

2) Convert 193(decimal) to a 10-but pattern using 2
s compliment notation/

so 193=0001100001
flip 1110011110
plus 1
1110011111, but the answer is 0011000001

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.
Posted
Updated 26-Apr-10 8:25am
v2
Comments
   
Very, very poor. You should not ask such questions. Learn elementary arithmetic at home, don't waste people's time. I tell you, not answering during exam is OK, not answering at home is laziness!
--SA
Rate this:
Please Sign up or sign in to vote.

Solution 5

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]

:)
   
v4
Rate this:
Please Sign up or sign in to vote.

Solution 3

for number 3 what I did so far is the mutliplication of the decimal point by 2( ex. 0.4375 x 2=0.875, 0.875x 2= 1.75 .....). So .4375=.0111 and 3.4375= 011.0111, now I am stuck how to finish this
   
Rate this:
Please Sign up or sign in to vote.

Solution 4

For floating point, what is typically done is storing the number as if it were an integer (so, "34375" instead of "3.4375"), then store how many places to shift the decimal places to the left or right. This is a concept closely related to scientific notation. Have another look at the links I sent you to make sure you understand how to store floating point numbers as a bit pattern, then modify that concept to use excess-4 notation.
   
Rate this:
Please Sign up or sign in to vote.

Solution 1

1) They didn't say 16-bit notation, they said excess-16 notation... Google and read up on it.

2) I don't really feel like answering that... perhaps Google 2's complement or wait for somebody else to answer that one.

3) Excess-4 notation, mantissa, floating point.

As an aside, I'm glad to see a student seek help after trying to answer the questions, and especially that you showed your work for your answer. Keep doing that and you will get good responses here at Code Project. :)
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100