This commit is contained in:
Roberto Ierusalimschy 1998-06-11 15:21:37 -03:00
parent 0845e73b6a
commit 1917149fdd
2 changed files with 8 additions and 3 deletions

View File

@ -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 */

4
lvm.c
View File

@ -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;