diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-12 07:25:48 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-05-12 07:25:48 +0000 |
commit | d2a68945e6c20cf5e68ef27387b31ac102fd493f (patch) | |
tree | ba76980b037addf2b97144d5727b6e251b2e8664 /numeric.c | |
parent | 16ea63ad692df3aa038178e57cb907df5d14a11b (diff) | |
download | ruby-d2a68945e6c20cf5e68ef27387b31ac102fd493f.tar.gz |
* numeric.c (flo_to_s): exponent needs 2 digits.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -585,10 +585,9 @@ flo_to_s(VALUE flt) } 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_resize(s, (len = RSTRING_LEN(s)) + decpt - digs + 2); + if (decpt > digs) memset(RSTRING_PTR(s) + len, '0', decpt - digs); rb_str_cat(s, ".0", 2); } else { @@ -615,7 +614,7 @@ flo_to_s(VALUE flt) } buf[1] = '.'; rb_str_cat(s, buf, digs + 1); - rb_str_catf(s, "e%+d", decpt - 1); + rb_str_catf(s, "e%+03d", decpt - 1); } return s; } |