diff options
author | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-18 12:57:40 +0000 |
---|---|---|
committer | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-03-18 12:57:40 +0000 |
commit | f7c0ed81c460e0ef4f21a74ebc67fc529efd25c3 (patch) | |
tree | 5cfa66fe61626895d74cf7666058ef9c230cc9e6 /numeric.c | |
parent | e1db132e12522abf4bf12e423a440ac6024dd2da (diff) | |
download | ruby-f7c0ed81c460e0ef4f21a74ebc67fc529efd25c3.tar.gz |
* bignum.c (rb_big_to_s, Bignum#to_s): remove its definition because
it is unified with Integer#to_s.
* numeric.c (int_to_s): treat Bignum values directly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54176 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -2959,6 +2959,7 @@ rb_fix2str(VALUE x, int base) * 12345.to_s(10) #=> "12345" * 12345.to_s(16) #=> "3039" * 12345.to_s(36) #=> "9ix" + * 78546939656932.to_s(36) #=> "rubyrules" * */ static VALUE @@ -2974,7 +2975,14 @@ int_to_s(int argc, VALUE *argv, VALUE x) base = NUM2INT(b); } - return rb_fix2str(x, base); + if (FIXNUM_P(x)) { + return rb_fix2str(x, base); + } + else if (RB_TYPE_P(x, T_BIGNUM)) { + return rb_big2str(x, base); + } + + return rb_any_to_s(x); } /* |