diff options
-rw-r--r-- | lib/compress.js | 1 | ||||
-rw-r--r-- | test/compress/numbers.js | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js index 442df59d..7c5558bd 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -2901,6 +2901,7 @@ merge(Compressor.prototype, { } if (isNaN(result)) return compressor.find_parent(AST_With) ? this : result; if (compressor.option("unsafe_math") + && result && typeof result == "number" && (this.operator == "+" || this.operator == "-")) { var digits = Math.max(0, decimals(left), decimals(right)); diff --git a/test/compress/numbers.js b/test/compress/numbers.js index 63a100b7..79fccfb4 100644 --- a/test/compress/numbers.js +++ b/test/compress/numbers.js @@ -765,3 +765,19 @@ issue_3536: { } expect_stdout: "number 99 11 121" } + +issue_3539: { + options = { + evaluate: true, + unsafe_math: true, + } + input: { + var a = -0 + -""; + console.log(0/a, 1/a, -1/a); + } + expect: { + var a = -0; + console.log(0/a, 1/a, -1/a); + } + expect_stdout: "NaN -Infinity Infinity" +} |