[Bf-committers] Verse 2005 Errors

Branan Riley branan at gmail.com
Thu Sep 14 18:10:47 CEST 2006


Any system using the proper IEEE floating point sizes will have
0x7f7fffff as the maximum float value. The largest (smallest, I
suppose) negative number should be 0xff7fffff. Sign bit is set.
0x7ffxxxxx (where x is any hex digit) is positive infinity, and
0xfffxxxxx is negative infinity.

On 9/14/06, Emil Brink <emil at obsession.se> wrote:
> 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
>
> and
>
> #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.
>
> Regards,
>
> /Emil
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>


More information about the Bf-committers mailing list