aboutsummaryrefslogtreecommitdiff
path: root/src/parseTools.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-11-08 19:13:57 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-11-08 19:13:57 -0800
commit11418ef9f027c503e371da0bf82aff9387826594 (patch)
tree6196dc075d32b5a262f6f7445c720215fc7fe08f /src/parseTools.js
parent8d20a1424af064991bee3c66ef83ba0886b01180 (diff)
emit proper large float constants when js opts are to be run
Diffstat (limited to 'src/parseTools.js')
-rw-r--r--src/parseTools.js7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index d25f9bd0..088fea16 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1166,6 +1166,7 @@ function makeVarDef(js) {
function ensureDot(value) {
value = value.toString();
if (value.indexOf('.') >= 0 || /[IN]/.test(value)) return value; // if already dotted, or Infinity or NaN, nothing to do here
+ if (RUNNING_JS_OPTS) return '(+' + value + ')'; // JS optimizer will run, we must do +x, and it will be corrected later
var e = value.indexOf('e');
if (e < 0) return value + '.0';
return value.substr(0, e) + '.0' + value.substr(e);
@@ -1182,11 +1183,7 @@ function asmEnsureFloat(value, type) { // ensures that a float type has either 5
}
// coerce if missing a '.', or if smaller than 1, so could be 1e-5 which has no .
if (type in Runtime.FLOAT_TYPES && (value.toString().indexOf('.') < 0 || Math.abs(value) < 1)) {
- if (RUNNING_JS_OPTS) {
- return '(+' + value + ')'; // JS optimizer will run, we must do +x, and it will be corrected later
- } else {
- return ensureDot(value);
- }
+ return ensureDot(value);
} else {
return value;
}