| Server IP : 162.214.74.102 / Your IP : 216.73.217.46 Web Server : Apache System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64 User : lrsys ( 1015) PHP Version : 5.6.40 Disable Function : exec,passthru,shell_exec,system MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/opt/cpanel/ea-ruby24/root/usr/share/ri/system/Symbol/ |
Upload File : |
U:RDoc::AnyMethod[iI"bit_length:ETI"Integer#bit_length;TF:privateo:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I";Returns the number of bits of the value of <i>int</i>.;To:RDoc::Markup::BlankLine o;
; [ I"%"the number of bits" means that ;TI"Mthe bit position of the highest bit which is different to the sign bit. ;TI"0(The bit position of the bit 2**n is n+1.) ;TI"CIf there is no such bit (zero or minus one), zero is returned.;T@o;
; [I"AI.e. This method returns ceil(log2(int < 0 ? -int : int+1)).;T@o:RDoc::Markup::Verbatim; [ I")(-2**10000-1).bit_length #=> 10001
;TI")(-2**10000).bit_length #=> 10000
;TI")(-2**10000+1).bit_length #=> 10000
;TI"((-2**1000-1).bit_length #=> 1001
;TI"((-2**1000).bit_length #=> 1000
;TI"((-2**1000+1).bit_length #=> 1000
;TI"&(-2**12-1).bit_length #=> 13
;TI"&(-2**12).bit_length #=> 12
;TI"&(-2**12+1).bit_length #=> 12
;TI"%-0x101.bit_length #=> 9
;TI"%-0x100.bit_length #=> 8
;TI"%-0xff.bit_length #=> 8
;TI"%-2.bit_length #=> 1
;TI"%-1.bit_length #=> 0
;TI"%0.bit_length #=> 0
;TI"%1.bit_length #=> 1
;TI"%0xff.bit_length #=> 8
;TI"%0x100.bit_length #=> 9
;TI"&(2**12-1).bit_length #=> 12
;TI"&(2**12).bit_length #=> 13
;TI"&(2**12+1).bit_length #=> 13
;TI"((2**1000-1).bit_length #=> 1000
;TI"((2**1000).bit_length #=> 1001
;TI"((2**1000+1).bit_length #=> 1001
;TI")(2**10000-1).bit_length #=> 10000
;TI")(2**10000).bit_length #=> 10001
;TI")(2**10000+1).bit_length #=> 10001
;T:@format0o;
; [I"IThis method can be used to detect overflow in Array#pack as follows.;T@o;; [
I"if n.bit_length < 32
;TI"# [n].pack("l") # no overflow
;TI"
else
;TI" raise "overflow"
;TI"end;T;
0:
@fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"int.bit_length -> integer
;T0[ I"();T@?FI"Symbol;TcRDoc::NormalClass00