# Another floating point question

This is a discussion on Another floating point question within the C Programming forums, part of the General Programming Boards category; The question asks, what is the largest unsigned int that can be represented between two floats? and what does it ...

1. ## Another floating point question

The question asks, what is the largest unsigned int that can be represented between two floats? and what does it round to?

The answer is that it falls between 2^(32) and 2^(32)-2^(8) and half way between those two floats is 2^(32)-2^(7) which rounds to 2^32 away from odd..

What i dont get is, where did they get 2^8 from???

can anyone help?

2. In a standard thirty-two bit float, you've only got 23 bits (plus an implicit one) of mantissa; so if you have an integer with two 1's twenty-four spots apart, then you can't represent it in a float.

3. so if i represent the largest unsigned int which is 2^32 we have in the exponent 2^159 which can still represent 2^32 right? 159-32 = 127 which is the bias. so where are we adding the extra 1? i know it falls off the right end -- but how did they choose 2^8??

4. Think for a minute: 1000 0000 0000 0000 0000 0000 1111 1111. Try to fit that into the mantissa of a floating point number.

5. sign or unsigned?

6. if u fit that in the mantissa it would over flow right? the bits on the right will fall to the guard bits

7. Originally Posted by NoobieGecko
if u fit that in the mantissa it would over flow right? the bits on the right will fall to the guard bits
What guard bits? What are you even talking about?

Remember how to put numbers into floating-point?
1. Write the number in binary notation
2. Put it into "binary scientific" form
3. Take the "1." in front and make it implicit
4. Put the exponent, plus 127, into the exponent field
5. Put the number behind the binary point, or the first 23 digits of it correctly rounded, into the mantissa

Now, do that for the number 4,294,967,551. Show your work, and you'll see what is going on.

8. i'm slow, i can't do that in 15 mins tabs, plus i got a midterm in 13 minutes =(
how about i do that after the midterm? i'll figure it out, thanks alot!!

9. Originally Posted by NoobieGecko
i'm slow, i can't do that in 15 mins tabs, plus i got a midterm in 13 minutes =(
how about i do that after the midterm? i'll figure it out, thanks alot!!
You're lucky you even got a response in under 1 hour. This is not the place for last minute cramming.

10. [QUOTE=NoobieGecko;727871]i'm slow, i can't do that in 15 mins tabs, plus i got a midterm in 13 minutes =(
how about i do that after the midterm? i'll figure it out, thanks alot!![/QUOTE

You go to Berkeley and you don't have a calculator that converts to binary? Shame.

Also, I can't use my calculator, so try the number 4,294,967,041 instead.