lua-users home
lua-l archive

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


These messages will disappear if Lua_Number casts double instead of float. Is there any reason that Lua has float for its numeric type?

On 23 Mar 2013 20:06, "Dirk Laurie" <dirk.laurie@gmail.com> wrote:
2013/3/23 Alexey Baskakov <alexey_baskakov@hotmail.com>:
> Hi!
>
> I still have the following warnings in MSVC 2010 at /W3 while compiling Lua with LUA_NUMBER float
>
>
> src\lmathlib.c(275): warning C4244: 'function' : conversion from 'double' to 'lua_Number', possible loss of data
> src\loslib.c(268): warning C4244: 'function' : conversion from 'double' to 'lua_Number', possible loss of data
>
> Is it deliberately? Should I just supress them?
>

They appear because "double" has more precision than "float", so when
the result of a routine that returns a double is converted to "float",
some kind of truncation or rounding takes place. The warnings are just
there to remind you, which is a good thing. I should ignore but not
suppress them.