APIdock / Ruby
/
method

size

ruby latest stable - Class: Integer
size()
public

Returns the number of bytes in the machine representation of int (machine dependent).

1.size  #=> 8
-1.size  #=> 8
2147483647.size  #=> 8
(256**10 - 1).size  #=> 10
(256**20 - 1).size  #=> 20
(256**40 - 1).size  #=> 40
static VALUE
int_size(VALUE num)
{
 if (FIXNUM_P(num)) {
 return fix_size(num);
 }
 else if (RB_TYPE_P(num, T_BIGNUM)) {
 return rb_big_size_m(num);
 }
 return Qnil;
}

AltStyle によって変換されたページ (->オリジナル) /