[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: print(268435456 + 1)
- From: "Leo Razoumov" <slonik.az@...>
- Date: Fri, 1 Sep 2006 12:07:12 -0400
On 9/1/06, Brian Weed <bw@imaginengine.com> wrote:
Aaron Brown wrote:
> Brian Weed wrote:
>
>> Is there something about adding numbers that I should know
>> about?
>
>> print(0x10000000)
>> 268435456
>>
>> print(0x10000000 + 0x00000001)
>> 268435456
>>
>> print(0x10000000 + 0x00000002)
>> 268435456
>
> 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?
>
> http://docs.sun.com/source/806-3568/ncg_goldberg.html
>
This is on Win32 (Lua is part of our game engine). We did not modify
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.
Brian
I do not see any problems on Intel x86 (32bits) Linux 2.6.13 with Lua
5.1.1, double Lua numbers
print( 268435456 + 1 )
268435457
print( 268435456 + 2 )
268435458
print( 268435456 + 3 )
268435459
Your problem is clearly platform specific. First compile vanila
standalone Lua-5.1.1 without game engine and try to see whether the
problem persists.
Hope is helps!
--Leo--