diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-12 07:02:45 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-12 07:02:45 +0000 |
commit | 1e6308e28d9852dc5f52c3842b1bfffc749cd4ba (patch) | |
tree | 7aa9d91be65b7e1929907db7c0305b99c0bdb630 /numeric.c | |
parent | abf45abeac827d8f79f620d33a46366c865f7ae8 (diff) |
* numeric.c (flo_to_s): fill lower zeros.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_2@27751 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -584,7 +584,11 @@ flo_to_s(VALUE flt) rb_str_cat(s, buf, digs + 1); } else if (decpt - digs < float_dig) { + long len; + char *ptr; rb_str_cat(s, buf, digs); + rb_str_resize(s, (len = RSTRING_LEN(s)) + decpt - digs); + memset(RSTRING_PTR(s) + len, '0', decpt - digs); rb_str_cat(s, ".0", 2); } else { |