1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

numeric.c: rb_int2str

* numeric.c (rb_int2str): conversion function to String for
  generic Integer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-03-26 01:55:14 +00:00
parent e9dc649d66
commit 23e5b482ca
3 changed files with 10 additions and 1 deletions

View file

@ -1,4 +1,7 @@
Sat Mar 26 10:54:49 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
Sat Mar 26 10:55:12 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* numeric.c (rb_int2str): conversion function to String for
generic Integer.
* numeric.c (rb_int_round): rounding function for generic
Integers.

View file

@ -1014,6 +1014,7 @@ VALUE rb_int_mul(VALUE x, VALUE y);
VALUE rb_int_idiv(VALUE x, VALUE y);
VALUE rb_int_modulo(VALUE x, VALUE y);
VALUE rb_int_round(VALUE num, int ndigits);
VALUE rb_int2str(VALUE num, int base);
VALUE rb_dbl_hash(double d);
VALUE rb_fix_plus(VALUE x, VALUE y);

View file

@ -3022,7 +3022,12 @@ int_to_s(int argc, VALUE *argv, VALUE x)
rb_scan_args(argc, argv, "01", &b);
base = NUM2INT(b);
}
return rb_int2str(x, base);
}
VALUE
rb_int2str(VALUE x, int base)
{
if (FIXNUM_P(x)) {
return rb_fix2str(x, base);
}