World's most popular travel blog for travel bloggers.

8-bit floating-point representation

, , No Comments
Problem Detail: 

I'm studying about representing fractional numbers as floating-point values. It is going to be an 8-bit representation. Somewhere in the text, it is said that:

8-bit floating-point representation

"We use the first bit to represent the sign (1 for negative, 0 for positive), the next four bits for the sum of 7 and the actual exponent (we add 7 to allow for negative exponents), and the last three bits for the mantissa's fractional part"

Now the question is: Why "7" -and not another value- must be added to the actual exponent ?

Asked By : Peter
Answered By : adrianN

With 4 bits you can represent 16 different values: 0,1,...,15. If you want to allow negative exponents it makes sense to take (approximately) half of the possible values to mean a negative exponent. By adding 7 to the exponent you map the values -7,-6,...,0,1,...,8 to the representable range. You might also want to look up two's complement.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/54288

3200 people like this

 Download Related Notes/Documents

0 comments:

Post a Comment

Let us know your responses and feedback