webmcp

changeset 431:4a33becb6f59

json.export(...): also avoid exponential notation for unsigned 64 bit integers represented as float
author jbe
date Thu Jan 14 18:52:19 2016 +0100 (2016-01-14)
parents 33d43f5a319b
children b8477aeb1d9f
files libraries/json/json.c
line diff
     1.1 --- a/libraries/json/json.c	Thu Jan 14 18:43:11 2016 +0100
     1.2 +++ b/libraries/json/json.c	Thu Jan 14 18:52:19 2016 +0100
     1.3 @@ -1121,8 +1121,8 @@
     1.4        if (isinf(num)) return luaL_error(L, "JSON export not possible for infinite numbers");
     1.5        // check if float is integral:
     1.6        if (trunc(num) == num) {
     1.7 -        // avoid exponential notation for INT64's represented as float:
     1.8 -        if (fabs(num) < 1e19) {
     1.9 +        // avoid exponential notation for (unsigned) 64 bit integers represented as float:
    1.10 +        if (fabs(num) < 1e20) {
    1.11            // use decimal notation:
    1.12            sprintf(numstr, "%.0f", num);
    1.13          } else {

Impressum / About Us