diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-03-19 20:04:38 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-19 20:04:38 -0700 |
commit | bcbce4709178f424c26564f44a9ae499173d74fa (patch) | |
tree | 23818445fa5483bc7afde2aeffd1c697c97b2ec4 /src/parseTools.js | |
parent | 7eda11db7c57aa4d231e468f87ded2d703034225 (diff) |
handle negative zero; fixes #921
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 2664baed..9fddacbb 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -818,7 +818,9 @@ function parseNumerical(value, type) { return '0'; } if (isNumber(value)) { - return parseFloat(value).toString(); // will change e.g. 5.000000e+01 to 50 + var ret = parseFloat(value); // will change e.g. 5.000000e+01 to 50 + if (type in Runtime.FLOAT_TYPES && value[0] == '-' && ret === 0) return '-0'; // fix negative 0, toString makes it 0 + return ret.toString(); } else { return value; } |