Method: Integer#size
- Defined in:
- numeric.c
#size ⇒ Integer
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
4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 |
# File 'numeric.c', line 4857
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;
}
|