/*
* call-seq:
* fix.to_s( base=10 ) -> aString
*
* Returns a string containing the representation of <i>fix</i> radix
* <i>base</i> (between 2 and 36).
*
* 12345.to_s #=> "12345"
* 12345.to_s(2) #=> "11000000111001"
* 12345.to_s(8) #=> "30071"
* 12345.to_s(10) #=> "12345"
* 12345.to_s(16) #=> "3039"
* 12345.to_s(36) #=> "9ix"
*
*/
static VALUE
fix_to_s(argc, argv, x)
int argc;
VALUE *argv;
VALUE x;
{
VALUE b;
int base;
rb_scan_args(argc, argv, "01", &b);
if (argc == 0) base = 10;
else base = NUM2INT(b);
if (base == 2) {
/* rb_fix2str() does not handle binary */
return rb_big2str(rb_int2big(FIX2INT(x)), 2);
}
return rb_fix2str(x, base);
}