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 | 16ea63ad692df3aa038178e57cb907df5d14a11b (patch) | |
tree | 6e21480253f1c193102f8ee48df150a4c45efee7 /numeric.c | |
parent | db96db4285378644ad041ac34df4736035620c08 (diff) |
* numeric.c (flo_to_s): fill lower zeros.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@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 { |