[Bf-committers] Verse 2005 Errors

Emil Brink emil at obsession.se
Thu Sep 14 17:13:50 CEST 2006

Emanuel Greisen wrote:
> Running GCC4.1.1 the MAX_FLT is defined as __MAX_FLT__ and that is built 
> in. But doing some testing I find that the binary rep is:
> 0x7f7fffff
> I am on a 32-bit Pentium 4.
> Here is the ugly hack that lead me to belive that the binary constant is 
> 0x7f7fffff

[hack snipped]

Thanks, I know. The problem is, we cannot portably specify a floating point
literal using a hex number in C. We can, if we require C99, but we don't.

Therefore, in order to still have just a true single literal, and not resort
to pointer trickery or (my favorite) unions, we need an actual floating-
point literal.

The affected compiler, in Jacques' original mail, was on the Windows plat-
form. I've seen the problem myself when building with ... I think it was
Visual Studio 2005, but that machine is not available to me at the moment,
which is why I'm asking Jacques for the value in his include files.

With the MS compilers, btw, the FLT_MAX constant is not built-in, it is
available as a literal in the <float.h> file. The <float.h> from the free
download Visual C toolkit I have available says:

#define FLT_MAX	3.402823466e+38f


#define	DLB_MAX 1.7976931348623158e+308

I have not investigated the bit pattern that the latter results in, but
it is very probably similar (by extension) to the one for floats.



More information about the Bf-committers mailing list