aboutsummaryrefslogtreecommitdiff
path: root/src/parseTools.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-30 13:34:00 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-10-02 17:31:37 -0700
commitd476a5881aa03136ab3ccd2c9002eb289f5b8960 (patch)
treeed603c1702a8e98bd77f1a0f2f5f3d307da65de3 /src/parseTools.js
parent154a96f439191c8422dc339d1ef6eb57d97d0409 (diff)
do not remove '.' from floats in parseNumerical
Diffstat (limited to 'src/parseTools.js')
-rw-r--r--src/parseTools.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index adde8d63..801e2e7a 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -930,7 +930,10 @@ function parseNumerical(value, type) {
}
if (isNumber(value)) {
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
+ if (type in Runtime.FLOAT_TYPES) {
+ if (value[0] === '-' && ret === 0) return '-.0'; // fix negative 0, toString makes it 0
+ if (!RUNNING_JS_OPTS) ret = asmEnsureFloat(ret, type);
+ }
return ret.toString();
} else {
return value;