summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/marshal.c b/marshal.c
index 8448f990e2..93005e9425 100644
--- a/marshal.c
+++ b/marshal.c
@@ -194,6 +194,10 @@ w_float(d, arg)
else if (isnan(d)) {
strcpy(buf, "nan");
}
+ else if (d == 0.0) {
+ if (1.0/d < 0) strcpy(buf, "-0");
+ else strcpy(buf, "0");
+ }
else {
/* xxx: should not use system's sprintf(3) */
sprintf(buf, "%.16g", d);