1

How do I write 0xFA in signed mantissa. I converted it to binary = 1111_1010. Not sure where to go from here.

The question is "If the register file has 8 bits width total, write the following in signed mantissa."

Also, an explanation of signed mantissa would be great!

  • The answer is probably in your text book... – Scott Solmer Oct 31 '13 at 01:28
  • I realize this was probably a time sensitive question, but would you mind letting me know what happened? Does my answer make sense? If it's not apparent from looking at it, my code is in C#. – Scott Solmer Oct 31 '13 at 18:33
  • I just turned my hw in yesterday, so the solution hasn't been posted yet. I can see what you did, however I think the answer was much more simple. I had wrote that there wasn't enough room for a signed mantissa given the bit width. There were parts a,b,c,d which had different hex values. In the ones with leading 0's I replaced the leading bit with a 1. That's how I saw it in the notes the professor gave. The notes had shown that for signed mantissa you replace the 0 bit with a 1 or if enough room add a 1. –  Nov 01 '13 at 21:54
  • That doesn't sound right... I'd like to see what your professor thinks the correct answer is. Please update when you see it. Also if my answer is correct please don't forget to accept it :) – Scott Solmer Nov 01 '13 at 21:59
  • The solution is -122. Not sure how to get there...any ideas? –  Nov 02 '13 at 23:54
  • Please see revised answer. Also please accept if it helped your understanding of the issue. I put quite a bit of effort into it :/ – Scott Solmer Nov 04 '13 at 20:42
  • Updated my answer. Hopefully this will clear up any confusion over "signed mantissa". – Scott Solmer Nov 08 '13 at 13:29

1 Answers1

0

So what you have to work with is a byte of data with an unknown type, apparently.
In order to write a number in signed mantissa (see Significand) one would expect that your dealing with a floating point type such as single or double. However you've only got a single byte.

A single is 8 bytes so surely it can't be that and double is double trouble. Also a half requires 16 bits. The only logical alternative type would be SByte but in that case you will never get any numbers that have any mantissa (significant digits) after the decimal. In fact there is no decimal. So Perhaps this is a trick question?

If you go on the assumption of SByte, you get -6x10^0

Just in case you want proof, or if your curious how this looks during debug:

    private void SByte2Dec()
    {   
     sbyte convertsHexToSByte = Convert.ToSByte("0xFA", 16);
     Single yourAnswer = Convert.ToSingle(convertsHexToSByte);
     label1.Text = Convert.ToString(youranswer);
    }

In this example I had a windows form with nothing but label1 on it.
Then I put SByte2Dec(); right under InitializeComponent();


  • The solution is -122. Not sure how to get there...any ideas?

Working backwards from the answer it's simple to see what your professor has done. He is assuming the MSB is the sign bit and the rest is treated like a 7 bit integer. There is a precedent for this, called "Signed Magnitude Representation" but it's not used in modern computing. These days pretty much everyone is using Two's compliment.

I take it this is a beginners course and rather than go though all the trouble of explaining two's compliment and data types your professor is mainly trying to drive home the point of the MSB being a sign bit. If you got the whole sign bit thing and don't know anything else about the way modern computer hardware performs calculations, then you would probably arrive at the same answer.

My guess is that your professor also took to wording the question in a strange way so as to throw you off the path if you tried to Google the answer. If you want to get him back, ask him what the difference between "1000 0000" and "000 0000" is. Also if you or anyone else in the class answered -6 and he counted it wrong, he should be fired. Those students should be awarded bonus points for teaching themselves about two's compliment.


  • Why would the signed mantissa be -6? I see that the 2's complement is -6 but signed mantissa is different?

I have you read the wiki article I linked to on "Significand"? The important thing to realize is that "signed mantissa" is not a data type. However, there are (were?) many different machine-specific data types that implemented their own versions of storing floating point numbers before the IEEE standard became widely adopted. These early data types were often referred to as DFP or decimal floating point numbers as opposed to binary floating point. Read this paper and for more in-depth understanding. Also this paper covers the topic quite well.

As I stated earlier, your professor most likely used the terminology "signed mantissa" to throw you off if you went searching the internet for the answer. Apparently you were expected to read between the lines and know that what he was really asking for was a form of decimal floating point, or Signed Magnitude Representation.

"Signed Mantissa" Two's Compliment

"Signed Mantissa" is to be interpreted as some form of Decimal Floating Point
Where as, Two's Compliment is a form of Binary Floating Point

Community
  • 1
  • 1
Scott Solmer
  • 3,871
  • 6
  • 44
  • 72
  • Thanks. He went over it in class the other day and said that the MSB is the sign bit and to convert the rest of the bits to decimal. We've gone over 2's complement as well, it was asked in the question as a part a,b,c type thing. Why would the signed mantissa be -6? I see that the 2's complement is -6 but signed mantissa is different? –  Nov 08 '13 at 00:57
  • Btw - I can't accept your answer; I don't have enough reputation points. –  Nov 08 '13 at 00:58