CHAPTER 01.05: FLOATING POINT REPRESENTATION: Biased Exponent: Example

 

In this segment, we're going to take an example of the biased exponent floating point representation. 

 

So, we are talking about floating point representation.  We are taking an example of floating point representation, but with the biased component, or the biased exponent, the exponent is biased.  So let's suppose somebody gives us an eight-bit word, so we have one, two, three, four, five, six, seven, eight. And, we may say, hey, let's suppose we use three for the mantissa, and we already know that we've got to use one for the sign of the number.  We are left with four now, one, two, three, four, four bits.  Now, in a previous example, we said, hey, we're going to use one bit for the sign of the exponent, and then we're going to use the other three for the exponent itself.  In the biased exponent, what you are doing is you're going to use all of them for the exponent, you're going to use all of them for the exponent. There is no separate bit for the sign of the exponent. Now, somebody might say, hey, does that mean that we have to rule out any negative exponents or positive exponent, depending on which ones we want to  . . . which we want to portray there, but that's not the case.  What the biased exponent does is that it takes care of the  negative and the positive exponents both.  And how does it do that?  It is as follows. So if you have four . . . you have four bits now for the biased exponent, let's suppose, you have four bits for the biased exponent.  Since you have four bits for the biased exponent, that means that the minimum value which you can have here in the base-10 notation is 0, that is if you have all 0s in these four bits.  And what is the maximum value?  The maximum value is going to be 15, and that's from . . . this is from 0000 in the four bits, and this is from 1111 in the four bits, you get 0 to 15.  So what you do is, you say, okay, this is the minimum value which I can have in the four bits of the biased exponent, this is the maximum value which I can have in the . . . in the biased exponent.  So they are all positive numbers, but what I'm going to do is I'm going to say 15 divided by 2 is 7.5.  I'm going to take the integer part of it, which is 7, right?  So 15 divided by 2 is 7.5, the integer part is 7, so, I was going to represent 0 to 15 in my biased exponent, so 0 to 15 will be the representation of the exponent  in the biased exponent, but 7, which is the half of 15 divided by 2, the integer part, I'm going to subtract 7 from here, so I get -7, and I'm going to subtract 7 from here, get 7 to 8, and that is the unbiased part. So what that means is that what you are basically doing is that you are going to represent numbers of 0 through 15 in the exponent, but those would be actually standing for the unbiased exponent of going from -7 to 8, which means as follows, that if your unbiased exponent is 8, let's suppose, let's suppose it's 2 to the power 8, then it would be represented as 15 in the biased exponent.  If this was 2 to the power -7, it would be represented as 0 in the biased exponent, and anything in between, so let's suppose it is . . . it is 10 . . . it is 2 here, then it would be 9 there, it's as simple as that, you're just simply adding 7. So, to go from biased to unbiased, you subtract 7, to go from biased to . . . unbiased to biased, you add 7, that's all you are doing.  So, I think this will be clearer if we go through an example, so we have -13.9 base-10, and I'm going to directly write down what the equivalent of this is in terms of the floating point representation, and we have done this previously, so if you want to look at the previous example, we have minus 1.101 base-2 times 2 to the power 011 base-2, or let me just write down as 11 in base-2.  So you can do this as homework if you don't want to look at the other example, or can't find it, go ahead and do this as homework to write it down in this particular form there.  Now, we're going to, so if we have . . . we have our eight bits which we have, so we're not going to worry about, right now, about the sign of exponent, which will be 1, of course, the mantissa is already taken care of which is 101, so let me just write those down, and then I'll just concentrate on my biased exponent.  So I got these eight-bits which I have, so these are for the biased exponent, this is for the sign of the number, and this is for the mantissa. 

 

So if somebody's saying that, hey, go ahead and represent -13.9 in an eight-bit word with a biased exponent, where the first bit is for the sign of the number, the next four bits are for the biased exponent, and the last three bits are for the mantissa.  So I'll put a 1 here, because it's a negative number right there, and I'll put 101 right here, because I have mantissa as 101, so the only thing which I need to be careful about is to find out, what should I put in the biased exponent?  I'm not going to put 11, or 0011, in the biased exponent, because this biased exponent has to stand for negative as well as positive exponents, so that's what I need to . . . what I need to think about.  So because I had 2 to the power 11 base-2, which is the same as 2 to the power 3, that's what I have, right? So since I said that in order to go from unbiased to biased, what are you supposed to do? You're going to add 7.  You're going to add 7 to it, because you have four bits for the unbiased exponent.  So if you have four bits for the biased exponent, that means that you can go from 0 to 15, half of 15 is 7.5, integer part is 7, so you'll be going from -7 to 8, so which means that in order to go from the unbiased to biased you're going to add 7 to it. So that means 3 becomes what?  3 plus 7 becomes 10. So since 3 plus 7 becomes 10, now you've got to find out what the binary equivalent of 10 is, and the binary equivalent of 10 is how much? It is 1010 base-2, I'm going to leave this as your homework.  So the binary equivalent of 10 in the base-10 is 1010 to the base-2. So that's what's going to go into the biased exponent now, because when you're going to convert this number back, you'll have to subtract 7 from this, which will be 10, 10 minus 7 will be 3, and you will get back the 3 value which you are looking for. So, going back to the eight-bit word which you have, so I'm going to show you the eight-bit word again, and we already had 1 here, because that was for the sign of the number, and we already had 101 here, because that was the mantissa of the number, right?  So what we are left with is the four bits right here. And the four bits here will be 1010, 1010, and that's the biased exponent. So that is the eight-bit representation of the number -13.9 in the biased eight-bit word, or eight-bit word with a biased exponent, I should say.  And that's the end of this segment.