# HG changeset patch # User jbe # Date 1452896838 -3600 # Node ID 0bbf7717ebfd3f8f203ecba1f89484b4eab74840 # Parent b8477aeb1d9f91380498e25063bb012c9b6ca142 Removed exception rule for encoding certain floats diff -r b8477aeb1d9f -r 0bbf7717ebfd libraries/json/json.c --- a/libraries/json/json.c Thu Jan 14 19:09:49 2016 +0100 +++ b/libraries/json/json.c Fri Jan 15 23:27:18 2016 +0100 @@ -1123,18 +1123,8 @@ if (isinf(num)) return luaL_error(L, "JSON export not possible for infinite numbers"); // check if float is integral: if ((double)trunc((double)num) == (double)num) { - // avoid exponential notation for integers fitting into lua_Integer represented as float: -#if LUA_VERSION_NUM >= 503 - if (num >= LUA_MININTEGER && num <= LUA_MAXINTEGER) { -#else - if (num >= INT64_MIN && num <= INT64_MAX) { -#endif - // use decimal notation: - sprintf(numstr, "%.0f", num); - } else { - // use maximum precision: - sprintf(numstr, "%.17g", num); // NOTE: e.g. 12345678901234560 - } + // use maximum precision: + sprintf(numstr, "%.17g", num); // NOTE: e.g. 12345678901234560 } else { // determine necessary precision to represent double precision floating point number: sprintf(numstr, "%.15g", num); // NOTE: e.g. 0.009 should not be 0.008999999999999999