lua-users home
lua-l archive

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


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?

Alexey.


----------------------------------------
> Date: Tue, 15 Jan 2013 17:24:18 -0200
> From: lhf@tecgraf.puc-rio.br
> To: lua-l@lists.lua.org
> Subject: Re: [ANN] LuaCSP framework: Communicating Sequential Processes in Lua
>
> > I have sent you the files.
>
> Thanks. I've been able to compile Lua 5.2.1 with float as numbers with the
> changes below. It compiles with no warnings under
>
> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 with -Wall -Wextra
>
> % diff luaconf.h,orig luaconf.h
> 386,387c386
> < #define LUA_NUMBER_DOUBLE
> < #define LUA_NUMBER double
> ---
> > #define LUA_NUMBER float
> 402,403c401,402
> < #define LUA_NUMBER_SCAN "%lf"
> < #define LUA_NUMBER_FMT "%.14g"
> ---
> > #define LUA_NUMBER_SCAN "%f"
> > #define LUA_NUMBER_FMT "%.7g"
> 416c415
> < #define lua_str2number(s,p) strtod((s), (p))
> ---
> > #define lua_str2number(s,p) strtof((s), (p))
> 419c418
> < #define lua_strx2number(s,p) strtod((s), (p))
> ---
> > #define lua_strx2number(s,p) strtof((s), (p))
> 430,431c429,430
> < #define luai_nummod(L,a,b) ((a) - floor((a)/(b))*(b))
> < #define luai_numpow(L,a,b) (pow(a,b))
> ---
> > #define luai_nummod(L,a,b) ((a) - floorf((a)/(b))*(b))
> > #define luai_numpow(L,a,b) (powf(a,b))
> 446a446,449
> > #if defined(lmathlib_c)
> > #define l_tg(x) x##f
> > #endif
> >
>