aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-24 16:37:12 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-24 16:38:22 -0700
commitaa80b0c6bd30e0cd6a80611548c2a51a3fe6b7ea (patch)
tree24e32abb3450e44290dde0e55ab6584afea0ed50 /src
parentf6b7cf2530cfad77a110aec1edca1bf8b1f7445e (diff)
do not turn 0*x to 0 in the case of floats, since NaNs break there; fixes #1661
Diffstat (limited to 'src')
-rw-r--r--src/parseTools.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/parseTools.js b/src/parseTools.js
index c0c8608c..ddfb9d01 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1520,8 +1520,8 @@ function getFastValue(a, op, b, type) {
}
return '(Math.imul(' + a + ',' + b + ')|0)';
}
- } else {
- if (a == '0') {
+ } else { // div
+ if (a == '0' && !(type in Runtime.FLOAT_TYPES)) { // careful on floats, since 0*NaN is not 0
return '0';
} else if (b == 1) {
return a;