From 4eb19660e9d736e7afb80f79a9b7cedfd6f7dabe Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 13 May 2010 22:27:10 +0000 Subject: [PATCH] * 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 --- ChangeLog | 4 ++++ marshal.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 82587bc36d..009fa06023 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Fri May 14 07:27:07 2010 Nobuyoshi Nakada + + * marshal.c (w_float): strip ".0" from end for rubyspec. + Fri May 14 01:17:10 2010 Yusuke Endoh * vm_core.c (rb_thread_struct): add a field for sigaltstack. 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); } }