Closes #4560: Lua uses double (again) for numbers. The float usage was not good for bit32 library where only ~24bits (out of 32) were correct, others were lost. This is supposed to be a temporary solution.

This commit is contained in:
Damjan Adamic
2017-03-06 18:21:41 +01:00
parent 6c493fddd9
commit acfeb7b47a
2 changed files with 11 additions and 11 deletions
+7 -7
View File
@@ -398,8 +398,8 @@
** ===================================================================
*/
#define LUA_NUMBER_FLOAT
#define LUA_NUMBER float
#define LUA_NUMBER_DOUBLE
#define LUA_NUMBER double
/*
@@ LUAI_UACNUMBER is the result of an 'usual argument conversion'
@@ -414,8 +414,8 @@
@@ lua_number2str converts a number to a string.
@@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
*/
#define LUA_NUMBER_SCAN "%f"
#define LUA_NUMBER_FMT "%.7g"
#define LUA_NUMBER_SCAN "%lf"
#define LUA_NUMBER_FMT "%.14g"
#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
#define LUAI_MAXNUMBER2STR 32 /* 16 digits, sign, point, and \0 */
@@ -423,7 +423,7 @@
/*
@@ l_mathop allows the addition of an 'l' or 'f' to all math operations
*/
#define l_mathop(x) (x##f)
#define l_mathop(x) (x)
/*
@@ -434,10 +434,10 @@
** systems, you can leave 'lua_strx2number' undefined and Lua will
** provide its own implementation.
*/
#define lua_str2number(s,p) strtof((s), (p))
#define lua_str2number(s,p) strtod((s), (p))
#if defined(LUA_USE_STRTODHEX)
#define lua_strx2number(s,p) strtof((s), (p))
#define lua_strx2number(s,p) strtod((s), (p))
#endif