C - floating point rounding
Posted
by hatorade
on Stack Overflow
See other posts from Stack Overflow
or by hatorade
Published on 2010-05-03T08:46:56Z
Indexed on
2010/05/03
8:58 UTC
Read the original article
Hit count: 342
I'm trying to understand how floating point numbers work.
I think I'd like to test out what I know / need to learn by evaluating the following: I would like to find the smallest x
such that x + 1 = x
, where x
is a floating point number.
As I understand it, this would happen in the case where x
is large enough so that x + 1
is closer to x than the next number higher than x representable by floating point. So intuitively it seems it would be the case where I don't have enough digits in the significand. Would this number x then be the number where the significand is all 1's. But then I can't seem to figure out what the exponent would have to be. Obviously it would have to be big (relative to 10^0, anyway).
© Stack Overflow or respective owner