summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-12 07:02:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-12 07:02:45 +0000
commit16ea63ad692df3aa038178e57cb907df5d14a11b (patch)
tree6e21480253f1c193102f8ee48df150a4c45efee7 /numeric.c
parentdb96db4285378644ad041ac34df4736035620c08 (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.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/numeric.c b/numeric.c
index f5e15d904d..23c54800ee 100644
--- a/numeric.c
+++ b/numeric.c
@@ -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 {