My Math Forum (http://mymathforum.com/math-forums.php)
-   Computer Science (http://mymathforum.com/computer-science/)
-   -   Floating Point Notation... (http://mymathforum.com/computer-science/19029-floating-point-notation.html)

 Primalscientist April 28th, 2011 06:45 AM

Floating Point Notation...

Hi All,

I think I may be coming to terms with Floating Point Notation [Finally...]

Example: [Using 1 Bit for the Sign, 3 Bits for the Exponent and 4 Bits for the Mantissa - This is how we were shown in class]

Binary Number: 01001010

So, first we extract the Mantissa to obtain .1010
Then the Exponent to obtain 100 [Using 3 Bit Excess Notation we come to the conclusion that 100 is actually 0, so no need to move the Radix Point]
Then the Sign Bit which is a 0, so the number will be non negative.

So, to the Mantissa, which is actually 5/8? [To gain 5/8, the first number after the Radix is a 1, which is 1/2, then a 0, then a 1 [which is 1/8] and the last which is a 0]

Another example:

Binary Number: 01101101

Mantissa = 1101
Exponent = 110 [Using 3 Bit Excess Notation we get +2]
Sign = 0 [Non Negative]

The Exponent then moves the Radix Point two places to the right of the Mantissa to get 11.01

The result = 3 1/4??

Regards,

Daz.

 CRGreathouse April 28th, 2011 06:57 AM

Re: Floating Point Notation...

Quote:
 Originally Posted by Primalscientist Example: [Using 1 Bit for the Sign, 3 Bits for the Exponent and 4 Bits for the Mantissa - This is how we were shown in class] Binary Number: 01001010 So, first we extract the Mantissa to obtain .1010 Then the Exponent to obtain 100 [Using 3 Bit Excess Notation we come to the conclusion that 100 is actually 0, so no need to move the Radix Point] Then the Sign Bit which is a 0, so the number will be non negative. So, to the Mantissa, which is actually 5/8? [To gain 5/8, the first number after the Radix is a 1, which is 1/2, then a 0, then a 1 [which is 1/8] and the last which is a 0]
Looks fine to me. I assume from what you write that the bias is 4 ("3 Bit Excess Notation"?) and that your notation does not use an implied 1.

I should also note that "mantissa" is out of favor; you should not use it except while in this class (obviously whatever the instructor says is right in the classroom). The proper/modern term is "significand".

Quote:
 Originally Posted by Primalscientist Binary Number: 01101101 Mantissa = 1101 Exponent = 110 [Using 3 Bit Excess Notation we get +2] Sign = 0 [Non Negative] The Exponent then moves the Radix Point two places to the right of the Mantissa to get 11.01 The result = 3 1/4?
Right. 11 = 3, .01 = 1/4.

 Primalscientist April 28th, 2011 07:04 AM

Re: Floating Point Notation...

You dont know how pleased I am that I FINALLY got my head round this!! YEAH!!!!
Yes, I can confirm that we are using 4 [3 Bit Excess Notation].
What is the implied 1?

Is this when converting from base 10 to base 2?

Thank you for clarifying for me!! :D

Daz.

I will change from Mantissa to Significand from now on then. Thanks again.

 CRGreathouse April 28th, 2011 11:11 AM

Re: Floating Point Notation...

Quote:
 Originally Posted by Primalscientist You dont know how pleased I am that I FINALLY got my head round this!! YEAH!!!!
Good for you. It's remarkably difficult to understand considering how easy it is once you do. :D

Quote:
 Originally Posted by Primalscientist Yes, I can confirm that we are using 4 [3 Bit Excess Notation].
I don't know the term "X Bit Excess Notation" but your very clear explanation made me assume that it's the same as what I call "bias 4". I suspect in general that "X Bit Excess" means "bias 2^(X-1)".

Quote:
 Originally Posted by Primalscientist What is the implied 1?
It's a way to cheat more precision out of the notation. :D (Alternate name: hidden 1.)

You'll notice that, other than 0, pretty much all numbers start with 1. If the number is 0.01 you would represent it as 1.00 * 2^-2, etc. The basic idea of the implied 1 is that you write all your numbers as "1.---" where --- is the significand. So the 4-bit significand of 1.01 would be 1010 without the implied 1 or 0100 with the implied 1 -- giving us an effective precision of 5 bits even though we only store 4. This does mean that there's no way to directly represent 0, but special techniques are used that allow 0 and nearby numbers to be represented differently -- "subnormal" numbers. (Similarly, floating point often encodes infinities and NaNs which are special in the same way.) If you ignore those the concept of an implied 1 is easy.

 Primalscientist May 2nd, 2011 07:52 AM

Re: Floating Point Notation...

Hi CRGreathouse,

Thank you for the explanation there. One step at a time for me :lol: !!!

Thanks again for helping me to understand it!!

Although you mention about using 5 bits, is this where truncation error comes in? Or am I barking up the wrong tree so to speak?

Best,

Daz.

 CRGreathouse May 2nd, 2011 08:55 AM

Re: Floating Point Notation...

You'll always have truncation error, but using the hidden/implied bit means that it's only half as large (on average).

 Primalscientist June 1st, 2011 01:40 AM

Re: Floating Point Notation...

I have my exam today...

I feel sick, I really do.

anyway, there will be questions with regards to what we have discussed, and i would like to thank you for your assistance.

with out your help, I dont know where I would be...

Best,

Darren.

 CRGreathouse June 1st, 2011 05:01 AM

Re: Floating Point Notation...

 Primalscientist June 1st, 2011 11:23 PM

Re: Floating Point Notation...

I think I blew it...

There was loads of questions, and not one on floating point representation which sort of surprised me...

 CRGreathouse June 2nd, 2011 06:29 AM

Re: Floating Point Notation...

So what did it cover?

 All times are GMT -8. The time now is 12:46 PM.