lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 1917149fdd737752451da2c5f2dfbe1adde72c20
parent 0845e73b6a374bd8eb2969a91ade56cb0407b929
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Thu, 11 Jun 1998 15:21:16 -0300

details.

Diffstat:
Mlobject.h | 7++++++-
Mlvm.c | 4++--
2 files changed, 8 insertions(+), 3 deletions(-)

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