diff --git a/lobject.h b/lobject.h index 286261ae..c2fa373a 100644 --- a/lobject.h +++ b/lobject.h @@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 1.18 1998/03/09 21:49:52 roberto Exp roberto $ +** $Id: lobject.h,v 1.19 1998/05/18 22:26:03 roberto Exp roberto $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -32,6 +32,11 @@ #define LUA_NUM_TYPE double #endif +/* +** format to convert number to strings +*/ +#define NUMBER_FMT "%g" + typedef LUA_NUM_TYPE real; #define Byte lua_Byte /* some systems have Byte as a predefined type */ diff --git a/lvm.c b/lvm.c index e4fc34c6..44416b0a 100644 --- a/lvm.c +++ b/lvm.c @@ -1,5 +1,5 @@ /* -** $Id: lvm.c,v 1.28 1998/03/30 13:57:23 roberto Exp roberto $ +** $Id: lvm.c,v 1.29 1998/05/31 22:18:24 roberto Exp roberto $ ** Lua virtual machine ** See Copyright Notice in lua.h */ @@ -75,7 +75,7 @@ int luaV_tostring (TObject *obj) if ((real)(-MAX_INT) <= f && f <= (real)MAX_INT && (real)(i=(int)f) == f) sprintf (s, "%d", i); else - sprintf (s, "%g", (double)nvalue(obj)); + sprintf (s, NUMBER_FMT, nvalue(obj)); tsvalue(obj) = luaS_new(s); ttype(obj) = LUA_T_STRING; return 0;