summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-05 13:59:30 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-05 13:59:30 -0800
commitaccc583fb7e0c859d7beffeab4120a79f527b282 (patch)
tree68bfaf9fa7f6f9220b032555c1f9bc15dc378559 /src
parentcf40973ef6a2b96ba755626f71bec9802f8aca95 (diff)
downloadbinaryen-accc583fb7e0c859d7beffeab4120a79f527b282.tar.gz
binaryen-accc583fb7e0c859d7beffeab4120a79f527b282.tar.bz2
binaryen-accc583fb7e0c859d7beffeab4120a79f527b282.zip
print negative 0
Diffstat (limited to 'src')
-rw-r--r--src/wasm.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/wasm.h b/src/wasm.h
index df42951d4..0ffca478b 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -122,6 +122,10 @@ struct Literal {
}
void printDouble(std::ostream &o, double d) {
+ if (d == 0 && 1/d < 0) {
+ o << "-0";
+ return;
+ }
const char *text = cashew::JSPrinter::numToString(d);
// spec interpreter hates floats starting with '.'
if (text[0] == '.') {