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:
parent
e9dc649d66
commit
23e5b482ca
3 changed files with 10 additions and 1 deletions
|
@ -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
|
* numeric.c (rb_int_round): rounding function for generic
|
||||||
Integers.
|
Integers.
|
||||||
|
|
|
@ -1014,6 +1014,7 @@ VALUE rb_int_mul(VALUE x, VALUE y);
|
||||||
VALUE rb_int_idiv(VALUE x, VALUE y);
|
VALUE rb_int_idiv(VALUE x, VALUE y);
|
||||||
VALUE rb_int_modulo(VALUE x, VALUE y);
|
VALUE rb_int_modulo(VALUE x, VALUE y);
|
||||||
VALUE rb_int_round(VALUE num, int ndigits);
|
VALUE rb_int_round(VALUE num, int ndigits);
|
||||||
|
VALUE rb_int2str(VALUE num, int base);
|
||||||
VALUE rb_dbl_hash(double d);
|
VALUE rb_dbl_hash(double d);
|
||||||
VALUE rb_fix_plus(VALUE x, VALUE y);
|
VALUE rb_fix_plus(VALUE x, VALUE y);
|
||||||
|
|
||||||
|
|
|
@ -3022,7 +3022,12 @@ int_to_s(int argc, VALUE *argv, VALUE x)
|
||||||
rb_scan_args(argc, argv, "01", &b);
|
rb_scan_args(argc, argv, "01", &b);
|
||||||
base = NUM2INT(b);
|
base = NUM2INT(b);
|
||||||
}
|
}
|
||||||
|
return rb_int2str(x, base);
|
||||||
|
}
|
||||||
|
|
||||||
|
VALUE
|
||||||
|
rb_int2str(VALUE x, int base)
|
||||||
|
{
|
||||||
if (FIXNUM_P(x)) {
|
if (FIXNUM_P(x)) {
|
||||||
return rb_fix2str(x, base);
|
return rb_fix2str(x, base);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue