mirror of
https://github.com/lua/lua
synced 2024-11-23 05:11:45 +03:00
better precision when converting numbers to strings.
This commit is contained in:
parent
e24f7fd2d2
commit
8396027516
4
lvm.c
4
lvm.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lvm.c,v 1.35 1998/12/30 13:16:50 roberto Exp roberto $
|
||||
** $Id: lvm.c,v 1.36 1998/12/30 17:26:49 roberto Exp roberto $
|
||||
** Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -85,7 +85,7 @@ int luaV_tostring (TObject *obj) {
|
||||
if ((real)LONG_MIN <= f && f <= (real)LONG_MAX && (real)(i=(long)f) == f)
|
||||
sprintf(s, "%ld", i);
|
||||
else
|
||||
sprintf(s, "%g", (double)nvalue(obj));
|
||||
sprintf(s, "%.15g", (double)nvalue(obj));
|
||||
tsvalue(obj) = luaS_new(s);
|
||||
ttype(obj) = LUA_T_STRING;
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user