Quote:
Originally Posted by BlueSpirit
Can anyone explain me what he means by "adding a bias of 127
|
Did you understand step 3?
(I also don't know how to show a superscript in forum text). I hope you understood that where you wrote
2e in step 3, the original you copied had somehow indicated it meant 2 to the power e.
After doing step 3 (assuming you understood it), you are supposed to add 127 to e. For numbers that can be represented in this format, the result of that addition will be a number in the range 1..255.
For example, say I started with 0.140625, which happens to be 9/64. In binary that is .001001 which is 1.001 * 2 to the negative 3.
So we add 127 to negative 3, getting 124 (which conveniently is in the range 1..255).
So the top bit is 0 indicating positive. The next 8 bits are 01111100 indicating the exponent of 124. The next three bits are 001 from the fractional part of 1.001
Quote:
" is an alternative to storing the exponent as a signed number"??"
|
The basic requirement was to store that exponent (in my example negative 3) and to reserve one of the 256 possible values of the 8 bit field in which that exponent is stored. One could have designed a floating point format in which a signed eight bit number was used for the exponent. A signed 8 bit number holds value -128 through +127. One might reserve -128, and allow exponents -127 through +127.
An unsigned 8 bit number holds values 0 through 255. By adding 127 and reserving the value 0, the actual format supports original exponents -126 through +128, which is only very slightly more useful than supporting -127 through +127. There were more important reasons (for the designer of the format) for adding 127 and then using an unsigned field, but those aren't as easy to explain. You should just need to understand that this format was designed this way.