[Bf-committers] Verse 2005 Errors

Branan Riley branan at gmail.com
Thu Sep 14 20:59:41 CEST 2006


16,777,215 * 2^127. Running that through Kcalc, I get
2.854495215270736302e+45. I'd do it out by hand to get an exact
number, but that's a 152-bit number, so I'm not going to even think
about it. If someone wants to run that through, and see what comes up
for the binary representation, that would be nifty.

On 9/14/06, Emil Brink <emil at obsession.se> wrote:
> Branan Riley wrote:
> > 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.
>
> Agreed. The problem was mainly how to get this exact bit sequence
> from a floating point literal. Having done a quick experiment, I
> now think that the proper value to use is 3.4028235e+38f.
>
> I have not actually done the bit-level maths to test that theory
> though, just tried loading 0x7f7fffff into a float using a simple
> pointer indirection (for variety), snprintf()ing it, and then
> sscanf()ing it back.
>
> Not there is any guarantee that the compiler uses the same code as
> sscanf() to read float literals, of course. Still, using the literal
> above generates the proper bit pattern here (Linux, GCC 4.1.1), so
> maybe there's hope it will in the various MS compilers, too.
>
> Anyway, thanks for the input.
>
> 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