lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

One more reason for the int32 patch?

Honestly, is D3D changing the behaviour of doubles (non-integer), too, and is there a performance downside to using that safety flag to make D3d not jump on tables?

- asko

(sorry for being lazy and not googling this; but it's not my itch, just curious :)

Stefan Boberg kirjoitti 1.9.2006 kello 19.24:

Direct3D is probably changing the FPU mode to single-precision under
your feet. There's an initialization flag you can pass to D3D on
creation which will avoid this.


-----Original Message-----
From: [mailto:lua-] On Behalf Of Brian Weed
Sent: 01 September 2006 18:17
To: Lua list
Subject: Re: print(268435456 + 1)

Brian Weed wrote:
Aaron Brown wrote:
Brian Weed wrote:

Is there something about adding numbers that I should know


print(0x10000000 + 0x00000001)

print(0x10000000 + 0x00000002)

I get 268435456, 268435457, and 268435458.  My first guess
is that you're using (single-precision) floats instead of
doubles.  What platform are you on?  Did you change
LUA_NUMBER when compiling?

This is on Win32 (Lua is part of our game engine).  We did not
LUA_NUMBER.  It's still double.
Lua is compiled as a static lib via Visual C++ 6.0.  The app is
compiled via Visual Studio 2005.


Ok, this is really weird...

The following C code has the same problem (while watching "d" in the
debugger in Visual C++ 6.0):

double d = 0x10000000;

d = d + 0x00000002;

doubles are supposed to be able to completely represent  a 32bit int