summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-18 12:57:40 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-03-18 12:57:40 +0000
commitad0b5ebc503ae188db87f5de0715ead017dd5977 (patch)
tree5cfa66fe61626895d74cf7666058ef9c230cc9e6 /numeric.c
parenta22ff208e527d2359fb28fe3c652950418a3148f (diff)
* 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.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index b87bb4bf7e..ba174f0104 100644
--- a/numeric.c
+++ b/numeric.c
@@ -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);
}
/*