webmcp
diff libraries/json/json.c @ 190:2c0db49591be
Increased decimal precision to 17 in json.export(...)
author | jbe |
---|---|
date | Sun Aug 10 19:48:09 2014 +0200 (2014-08-10) |
parents | 44344b4a52c1 |
children | e61bf25f3d04 |
line diff
1.1 --- a/libraries/json/json.c Sun Aug 10 19:41:45 2014 +0200 1.2 +++ b/libraries/json/json.c Sun Aug 10 19:48:09 2014 +0200 1.3 @@ -1021,7 +1021,7 @@ 1.4 int pretty; // pretty printing on? (i.e. printing with indentation) 1.5 luaL_Buffer buf; // Lua buffer containing result string 1.6 lua_Number num; // number to encode 1.7 - char numstr[20]; // encoded number (sign, zero, point, 16 significant digits, and terminating NULL byte) 1.8 + char numstr[21]; // encoded number (sign, zero, point, 17 significant digits, and terminating NULL byte) 1.9 const char *str; // string to encode 1.10 size_t strlen; // length of string to encode 1.11 size_t strpos ; // position in string or position of current key 1.12 @@ -1094,7 +1094,7 @@ 1.13 // throw error if number is positive or negative infinity: 1.14 if (isinf(num)) return luaL_error(L, "JSON export not possible for infinite numbers"); 1.15 // add Lua's string encoding of the number to the output buffer: 1.16 - sprintf(numstr, "%.16g", num); 1.17 + sprintf(numstr, "%.17g", num); 1.18 luaL_addstring(&buf, numstr); 1.19 break; 1.20 // value to encode is of type boolean: