[], a ;TI"8Bignum is treated as if it were an infinite-length ;TI"2bitstring with 2's complement representation.;T@o; ;[I"/While Fixnum values are immediate, Bignum ;TI"Bobjects are not---assignment and parameter passing work with ;TI"7references to objects, not the objects themselves.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0o;;[o; ;[I"QWhen mathn is required Bignum's division and exponentiation are enhanced to ;TI">return more precise values from mathematical expressions.;T;I"lib/mathn.rb;T;0;0;0[ [U:RDoc::Constant[i I"GMP_VERSION;TI"Bignum::GMP_VERSION;T00o;;[ ;@ ;0@ @cRDoc::NormalClass0[ [[I"
class;T[[:public[ [:protected[ [:private[ [I"
instance;T[[;[,[I"%;TI"
bignum.c;T[I"&;T@C[I"*;T@C[I"**;T@C[I"+;T@C[I"-;T@C[I"-@;T@C[I"/;T@C[I"<;T@C[I"<<;T@C[I"<=;T@C[I"<=>;T@C[I"==;T@C[I"===;T@C[I">;T@C[I">=;T@C[I">>;T@C[I"[];T@C[I"^;T@C[I"abs;T@C[I"bit_length;T@C[I"coerce;T@C[I"div;T@C[I"divmod;T@C[I" eql?;T@C[I"
even?;T@C[I" fdiv;T@C[I" hash;T@C[I"inspect;T@C[I"magnitude;T@C[I"modulo;T@C[I" odd?;T@C[I"power!;FI"lib/mathn.rb;T[I"remainder;T@C[I" size;T@C[I" to_f;T@C[I" to_s;T@C[I"|;T@C[I"~;T@C[;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ;0;0[@ @'@'cRDoc::TopLevel eql%3f-i.ri 0000644 00000001137 15240010367 0006405 0 ustar 00 U:RDoc::AnyMethod[iI" eql?:ETI"Bignum#eql?;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"7Returns true only if obj is a ;TI"JBignum with the same value as big. Contrast this ;TI"Bwith Bignum#==, which performs type conversions.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"068719476736.eql?(68719476736.0) #=> false;T:@format0:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"&big.eql?(obj) -> true or false
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 magnitude-i.ri 0000644 00000000714 15240010367 0007303 0 ustar 00 U:RDoc::AnyMethod[iI"magnitude:ETI"Bignum#magnitude;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I".Returns the absolute value of big.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"7-1234567890987654321.abs #=> 1234567890987654321;T:@format0:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"big.magnitude -> aBignum;T0[ I"();T@FI"Bignum;TcRDoc::NormalClass00 coerce-i.ri 0000644 00000001252 15240010367 0006564 0 ustar 00 U:RDoc::AnyMethod[iI"coerce:ETI"Bignum#coerce;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"NReturns an array with both a +numeric+ and a +big+ represented as Bignum ;TI"
objects.;To:RDoc::Markup::BlankLine o;
; [I":This is achieved by converting +numeric+ to a Bignum.;T@o;
; [I"KA TypeError is raised if the +numeric+ is not a Fixnum or Bignum type.;T@o:RDoc::Markup::Verbatim; [I"F(0x3FFFFFFFFFFFFFFF+1).coerce(42) #=> [42, 4611686018427387904];T:@format0:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"$big.coerce(numeric) -> array
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 %26-i.ri 0000644 00000000520 15240010367 0005615 0 ustar 00 U:RDoc::AnyMethod[iI"&:ETI"
Bignum#&;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"8Performs bitwise +and+ between _big_ and _numeric_.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"!big & numeric -> integer
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 %2a-i.ri 0000644 00000000510 15240010367 0005667 0 ustar 00 U:RDoc::AnyMethod[iI"*:ETI"
Bignum#*;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"4Multiplies big and other, returning the result.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"big * other -> Numeric
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 %3e%3e-i.ri 0000644 00000000545 15240010367 0006201 0 ustar 00 U:RDoc::AnyMethod[iI">>:ETI"Bignum#>>;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"JShifts big right _numeric_ positions (left if _numeric_ is negative).;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I""big >> numeric -> integer
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 div-i.ri 0000644 00000000521 15240010367 0006104 0 ustar 00 U:RDoc::AnyMethod[iI"div:ETI"Bignum#div;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"6Performs integer division: returns integer value.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I" big.div(other) -> integer
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 %3c%3d-i.ri 0000644 00000000627 15240010367 0006177 0 ustar 00 U:RDoc::AnyMethod[iI"<=:ETI"Bignum#<=;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"CReturns true if the value of big is ;TI"5less than or equal to that of real.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"$big <= real -> true or false
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 %3e%3d-i.ri 0000644 00000000632 15240010367 0006175 0 ustar 00 U:RDoc::AnyMethod[iI">=:ETI"Bignum#>=;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"CReturns true if the value of big is ;TI"8greater than or equal to that of real.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"$big >= real -> true or false
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 size-i.ri 0000644 00000001023 15240010367 0006272 0 ustar 00 U:RDoc::AnyMethod[iI" size:ETI"Bignum#size;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"BReturns the number of bytes in the machine representation of ;TI"big.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"!(256**10 - 1).size #=> 12
;TI"!(256**20 - 1).size #=> 20
;TI" (256**40 - 1).size #=> 40;T:@format0:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"big.size -> integer
;T0[ I"();T@FI"Bignum;TcRDoc::NormalClass00 %3e-i.ri 0000644 00000000613 15240010367 0005700 0 ustar 00 U:RDoc::AnyMethod[iI">:ETI"
Bignum#>;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"CReturns true if the value of big is ;TI",greater than that of real.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"#big > real -> true or false
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 %2a%2a-i.ri 0000644 00000001320 15240010367 0006157 0 ustar 00 U:RDoc::AnyMethod[iI"**:ETI"Bignum#**;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"KRaises _big_ to the _exponent_ power (which may be an integer, float, ;TI"Bor anything that will coerce to a number). The result may be ;TI"a Fixnum, Bignum, or Float;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"/123456789 ** 2 #=> 15241578750190521
;TI".123456789 ** 1.2 #=> 5126464716.09932
;TI"0123456789 ** -2 #=> 6.5610001194102e-17;T:@format0:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I""big ** exponent -> numeric
;T0[[I"power!;Fo;; [ ;I"lib/mathn.rb;T;0I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 %2f-i.ri 0000644 00000000657 15240010367 0005710 0 ustar 00 U:RDoc::AnyMethod[iI"/:ETI"
Bignum#/;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"EPerforms division: the class of the resulting object depends on ;TI"Cthe class of numeric and on the magnitude of the ;TI"result.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I" big / other -> Numeric
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 %5b%5d-i.ri 0000644 00000001252 15240010367 0006175 0 ustar 00 U:RDoc::AnyMethod[iI"[]:ETI"Bignum#[];TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"JBit Reference---Returns the nth bit in the (assumed) binary ;TI"Drepresentation of big, where big[0] is the least ;TI"significant bit.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [ I"a = 9**15
;TI"50.downto(0) do |n|
;TI" print a[n]
;TI" end
;T:@format0o;
; [I"produces:;T@o;; [I"8000101110110100000111000011110010100111100010111001;T;
0:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"big[n] -> 0, 1
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 to_s-i.ri 0000644 00000001377 15240010367 0006300 0 ustar 00 U:RDoc::AnyMethod[iI" to_s:ETI"Bignum#to_s;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"HReturns a string containing the representation of big radix ;TI" base (2 through 36).;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [
I"012345654321.to_s #=> "12345654321"
;TI"G12345654321.to_s(2) #=> "1011011111110110111011110000110001"
;TI"112345654321.to_s(8) #=> "133766736061"
;TI".12345654321.to_s(16) #=> "2dfdbbc31"
;TI"-78546939656932.to_s(36) #=> "rubyrules";T:@format0:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"$big.to_s(base=10) -> string
;T0[[I"inspect;To;; [ ;@;0I"(p1 = v1);T@FI"Bignum;TcRDoc::NormalClass00 %5e-i.ri 0000644 00000000531 15240010367 0005701 0 ustar 00 U:RDoc::AnyMethod[iI"^:ETI"
Bignum#^;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"APerforms bitwise +exclusive or+ between _big_ and _numeric_.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"!big ^ numeric -> integer
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 %3c-i.ri 0000644 00000000610 15240010367 0005673 0 ustar 00 U:RDoc::AnyMethod[iI"<:ETI"
Bignum#<;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"CReturns true if the value of big is ;TI")less than that of real.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"#big < real -> true or false
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 divmod-i.ri 0000644 00000000512 15240010367 0006604 0 ustar 00 U:RDoc::AnyMethod[iI"divmod:ETI"Bignum#divmod;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"%See Numeric#divmod.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"$big.divmod(numeric) -> array
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 to_f-i.ri 0000644 00000000625 15240010367 0006256 0 ustar 00 U:RDoc::AnyMethod[iI" to_f:ETI"Bignum#to_f;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"HConverts big to a Float. If big doesn't ;TI"9fit in a Float, the result is infinity.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"big.to_f -> float
;T0[ I"();T@FI"Bignum;TcRDoc::NormalClass00 %7c-i.ri 0000644 00000000517 15240010367 0005705 0 ustar 00 U:RDoc::AnyMethod[iI"|:ETI"
Bignum#|;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"7Performs bitwise +or+ between _big_ and _numeric_.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"!big | numeric -> integer
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 modulo-i.ri 0000644 00000000562 15240010367 0006626 0 ustar 00 U:RDoc::AnyMethod[iI"modulo:ETI"Bignum#modulo;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I";Returns big modulo other. See Numeric.divmod for more ;TI"information.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"#big.modulo(other) -> Numeric;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 odd%3f-i.ri 0000644 00000000530 15240010367 0006366 0 ustar 00 U:RDoc::AnyMethod[iI" odd?:ETI"Bignum#odd?;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I">Returns true if big is an odd number.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"big.odd? -> true or false
;T0[ I"();T@FI"Bignum;TcRDoc::NormalClass00 %3d%3d%3d-i.ri 0000644 00000001123 15240010367 0006464 0 ustar 00 U:RDoc::AnyMethod[iI"===:ETI"Bignum#===;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"EReturns true only if obj has the same value ;TI"Gas big. Contrast this with Bignum#eql?, which ;TI"5requires obj to be a Bignum.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I",68719476736 == 68719476736.0 #=> true;T:@format0:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I""big == obj -> true or false
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 %2d%40-i.ri 0000644 00000000511 15240010367 0006104 0 ustar 00 U:RDoc::AnyMethod[iI"-@:ETI"Bignum#-@;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I":Unary minus (returns an integer whose value is 0-big);T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"-big -> integer
;T0[ I"();T@FI"Bignum;TcRDoc::NormalClass00 %7e-i.ri 0000644 00000001205 15240010367 0005702 0 ustar 00 U:RDoc::AnyMethod[iI"~:ETI"
Bignum#~;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [ I"CInverts the bits in big. As Bignums are conceptually infinite ;TI"Dlength, the result acts as if it had an infinite number of one ;TI"Abits to the left. In hex representations, this is displayed ;TI".as two periods to the left of the digits.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"8sprintf("%X", ~0x1122334455) #=> "..FEEDDCCBBAA";T:@format0:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"~big -> integer
;T0[ I"();T@FI"Bignum;TcRDoc::NormalClass00 %2b-i.ri 0000644 00000000502 15240010367 0005671 0 ustar 00 U:RDoc::AnyMethod[iI"+:ETI"
Bignum#+;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I".Adds big and other, returning the result.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"big + other -> Numeric
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 abs-i.ri 0000644 00000000672 15240010367 0006076 0 ustar 00 U:RDoc::AnyMethod[iI"abs:ETI"Bignum#abs;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I".Returns the absolute value of big.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I"7-1234567890987654321.abs #=> 1234567890987654321;T:@format0:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"big.abs -> aBignum;T0[ I"();T@FI"Bignum;TcRDoc::NormalClass00 %2d-i.ri 0000644 00000000510 15240010367 0005672 0 ustar 00 U:RDoc::AnyMethod[iI"-:ETI"
Bignum#-;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"4Subtracts other from big, returning the result.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"big - other -> Numeric
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 %3c%3c-i.ri 0000644 00000000545 15240010367 0006175 0 ustar 00 U:RDoc::AnyMethod[iI"<<:ETI"Bignum#<<;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"JShifts big left _numeric_ positions (right if _numeric_ is negative).;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I""big << numeric -> integer
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 %3d%3d-i.ri 0000644 00000001120 15240010367 0006165 0 ustar 00 U:RDoc::AnyMethod[iI"==:ETI"Bignum#==;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"EReturns true only if obj has the same value ;TI"Gas big. Contrast this with Bignum#eql?, which ;TI"5requires obj to be a Bignum.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [I",68719476736 == 68719476736.0 #=> true;T:@format0:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"!big == obj -> true or false;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 %3c%3d%3e-i.ri 0000644 00000001066 15240010367 0006472 0 ustar 00 U:RDoc::AnyMethod[iI"<=>:ETI"Bignum#<=>;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"EComparison---Returns -1, 0, or +1 depending on whether +big+ is ;TI"Aless than, equal to, or greater than +numeric+. This is the ;TI"'basis for the tests in Comparable.;To:RDoc::Markup::BlankLine o;
; [I":+nil+ is returned if the two values are incomparable.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"+big <=> numeric -> -1, 0, +1 or nil
;T0[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass00 power%21-i.ri 0000644 00000000360 15240010367 0006667 0 ustar 00 U:RDoc::AnyMethod[iI"power!:EFI"Bignum#power!;TF:publico:RDoc::Markup::Document:@parts[ :
@fileI"lib/mathn.rb;T:0@omit_headings_from_table_of_contents_below000[ I" (p1);T@FI"Bignum;TcRDoc::NormalClass0[@FI"**;T even%3f-i.ri 0000644 00000000534 15240010367 0006561 0 ustar 00 U:RDoc::AnyMethod[iI"
even?:ETI"Bignum#even?;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"?Returns true if big is an even number.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I" big.even? -> true or false
;T0[ I"();T@FI"Bignum;TcRDoc::NormalClass00 hash-i.ri 0000644 00000000505 15240010367 0006247 0 ustar 00 U:RDoc::AnyMethod[iI" hash:ETI"Bignum#hash;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"0Compute a hash based on the value of _big_.;T:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"big.hash -> fixnum
;T0[ I"();T@FI"Bignum;TcRDoc::NormalClass00 bit_length-i.ri 0000644 00000002375 15240010367 0007452 0 ustar 00 U:RDoc::AnyMethod[iI"bit_length:ETI"Bignum#bit_length;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I";Returns the number of bits of the value of int.;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"
;TI"((-2**1000-1).bit_length #=> 1001
;TI"((-2**1000).bit_length #=> 1000
;TI"((-2**1000+1).bit_length #=> 1000
;TI"
;TI"((2**1000-1).bit_length #=> 1000
;TI"((2**1000).bit_length #=> 1001
;TI"((2**1000+1).bit_length #=> 1001
;TI"
;TI")(2**10000-1).bit_length #=> 10000
;TI")(2**10000).bit_length #=> 10001
;TI"((2**10000+1).bit_length #=> 10001;T:@format0:
@fileI"
bignum.c;T:0@omit_headings_from_table_of_contents_below0I"int.bit_length -> integer
;T0[ I"();T@)FI"Bignum;TcRDoc::NormalClass00