diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-05 09:25:39 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-08-05 09:25:39 +0000 |
commit | 359d53787821dc287d0411565801d54791f0a9c6 (patch) | |
tree | ee038ea590732e9c0e0acba7e96453c4e0ff0d25 /marshal.c | |
parent | b35f5db57ebd756361cfa41555f1c652ec49499b (diff) | |
download | ruby-359d53787821dc287d0411565801d54791f0a9c6.tar.gz |
* marshal.c (w_float): should not append a dot if no fractal part
exists. [ruby-dev:41936]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'marshal.c')
-rw-r--r-- | marshal.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -376,8 +376,8 @@ w_float(double d, struct dump_arg *arg) digs = (int)(e - p); if (decpt < -3 || decpt > digs) { buf[len++] = p[0]; - buf[len++] = '.'; - memcpy(buf + len, p + 1, --digs); + if (--digs > 0) buf[len++] = '.'; + memcpy(buf + len, p + 1, digs); len += digs; len += snprintf(buf + len, sizeof(buf) - len, "e%d", decpt - 1); } |