[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Suggestion: Full use of 'lua_number2str()'
- From: Asko Kauppi <asko.kauppi@...>
- Date: Tue, 30 Nov 2004 03:50:45 +0200
I faced an issue last night, where an ARM-Linux cross compiled Lua
5.0.2 gave funny floating point output. It seems like a system bug I'll
need to come over, but studying it made me realize 'lua_number2str()'
is there, but not all the way. Why is that?
grep -r NUMBER_FMT *
include/luaconf.h:#define LUA_NUMBER_FMT "%.14g"
include/luaconf.h:#define lua_number2str(s,n) sprintf((s),
LUA_NUMBER_FMT, (n))
src/lib/liolib.c: fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)) >
0;
src/luac/print.c: printf(LUA_NUMBER_FMT,nvalue(o));
The 'liolib.c' and 'print.c' files could have an #ifdef, using
'lua_number2str()' in case it is defined. I will be making such a patch
(in order to run Lua on that ARM box); would there be consensus to wish
this in the mainstream releases, too?
-ak