summaryrefslogtreecommitdiff
path: root/marshal.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-13 22:27:10 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-13 22:27:10 +0000
commit4eb19660e9d736e7afb80f79a9b7cedfd6f7dabe (patch)
treed45658e0d1a2d4e8a4fe8ff7ff25f1d40a418322 /marshal.c
parentccbdebf5a97ae0e7433f09d61f65f05e58877ba8 (diff)
* marshal.c (w_float): strip ".0" from end for rubyspec.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r--marshal.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/marshal.c b/marshal.c
index 857dd7361c..edcb9556cb 100644
--- a/marshal.c
+++ b/marshal.c
@@ -369,7 +369,10 @@ w_float(double d, struct dump_arg *arg)
else w_cstr("0", arg);
}
else {
- w_bytes(buf, ruby_dbl2cstr(d, buf, (int)sizeof(buf)), arg);
+ int len = ruby_dbl2cstr(d, buf, (int)sizeof(buf));
+ if (len > 2 && buf[len - 1] == '0' && buf[len - 2] == '.')
+ len -= 2;
+ w_bytes(buf, len, arg);
}
}