[Bf-committers] Verse 2005 Errors
emil at obsession.se
Thu Sep 14 23:05:20 CEST 2006
Branan Riley wrote:
> and I just realized what I've done wrong. 1.11111111111111111111111.
> NOT 111111111111111111111111. Subtracting 23 from the exponent to make
> up for my stupidity gives... 340282346638528859811704183484516925440
> which is 3.402823466385288598e+38
> *slaps forehead*
Exactly, that period is the "binary period", separating the integer
part of the number from the fractional part. Thanks for clearing that
up, that is what I didn't get with your first posting.
Now, the thing is that even given that exact (?) decimal version of
the number, I'm still not sure how to figure out in a totally "safe"
manner where the precision actually ends.
For sure, a float does not have that many decimal digits of precision,
my testing says it's enough to use 3.40282347e+38, i.e. nine digits
I don't dare use all the digits in the literal, since that is exactly
what triggers the compilation error on some Microsoft compilers; they
complain about the constant being "too large" (see start of thread).
More information about the Bf-committers