ÿØÿà JFIF    ÿÛ „ ( %!1!%*+...983,7(-.- PK` ]j}}MM gcdlcm-i.rinu[U:RDoc::AnyMethod[iI" gcdlcm:ETI"Integer#gcdlcm;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"6Returns an array; [int.gcd(int2), int.lcm(int2)].;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"/2.gcdlcm(2) #=> [2, 2] ;TI"03.gcdlcm(-7) #=> [1, 21] ;TI"I((1<<31)-1).gcdlcm((1<<61)-1) #=> [1, 4951760154835678088235319297];T: @format0: @fileI"rational.c;T:0@omit_headings_from_table_of_contents_below0I"!int.gcdlcm(int2) -> array ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]>%25-i.rinu[U:RDoc::AnyMethod[iI"%:ETI"Integer#%;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"4Returns +self+ modulo +other+ as a real number.;To:RDoc::Markup::BlankLineo; ; [I"KFor integer +n+ and real number +r+, these expressions are equivalent:;T@o:RDoc::Markup::Verbatim; [I" n % r ;TI"n-r*(n/r).floor ;TI"n.divmod(r)[1] ;T: @format0o; ; [I"See Numeric#divmod.;T@o; ; [I"Examples:;T@o; ; [I" 10 % 2 # => 0 ;TI" 10 % 3 # => 1 ;TI" 10 % 4 # => 2 ;TI" ;TI" 10 % -2 # => 0 ;TI"!10 % -3 # => -2 ;TI"!10 % -4 # => -2 ;TI" ;TI""10 % 3.0 # => 1.0 ;TI"$10 % Rational(3, 1) # => (1/1) ;T; 0o; ; [I".Integer#modulo is an alias for Integer#%.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"!self % other -> real_number ;T0[[I" modulo;T@ I" (p1);T@,FI" Integer;TcRDoc::NormalClass00PK` ].S to_r-i.rinu[U:RDoc::AnyMethod[iI" to_r:ETI"Integer#to_r;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"%Returns the value as a rational.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"1.to_r #=> (1/1) ;TI"/(1<<64).to_r #=> (18446744073709551616/1);T: @format0: @fileI"rational.c;T:0@omit_headings_from_table_of_contents_below0I"int.to_r -> rational ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ] D;remainder-i.rinu[U:RDoc::AnyMethod[iI"remainder:ETI"Integer#remainder;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I" 3 ;TI")11.remainder(-4) # => 3 ;TI"*-11.remainder(4) # => -3 ;TI"*-11.remainder(-4) # => -3 ;TI" ;TI")12.remainder(4) # => 0 ;TI")12.remainder(-4) # => 0 ;TI")-12.remainder(4) # => 0 ;TI")-12.remainder(-4) # => 0 ;TI" ;TI"+13.remainder(4.0) # => 1.0 ;TI",13.remainder(Rational(4, 1)) # => (1/1);T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"%remainder(other) -> real_number ;T0[I" (p1);T@ FI" Integer;TcRDoc::NormalClass00PK` ]oe round-i.rinu[U:RDoc::AnyMethod[iI" round:ETI"Integer#round;TF: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"LRounds +int+ to a given precision in decimal digits (default 0 digits).;To:RDoc::Markup::BlankLineo; ; [I"PPrecision may be negative. Returns a floating point number when +ndigits+ ;TI"?is positive, +self+ for zero, and round down for negative.;T@o:RDoc::Markup::Verbatim; [I"1.round #=> 1 ;TI"1.round(2) #=> 1.0 ;TI"15.round(-1) #=> 20;T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"0int.round([ndigits]) -> integer or float ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]t++cdesc-Integer.rinu[U:RDoc::NormalClass[iI" Integer:ET@I" Numeric;To:RDoc::Markup::Document: @parts[ o;;[o:RDoc::Markup::Paragraph;[I"MBigDecimal extends the native Integer class to provide the #to_d method.;To:RDoc::Markup::BlankLineo; ;[I"RWhen you require the BigDecimal library in your application, this methodwill ;TI"%be available on Integer objects.;T: @fileI"*ext/bigdecimal/lib/bigdecimal/util.rb;T:0@omit_headings_from_table_of_contents_below0o;;[o; ;[I"#Add double dispatch to Integer;T; I""ext/openssl/lib/openssl/bn.rb;T; 0o;;[; I"lib/prime.rb;T; 0o;;[o; ;[I"JThis class is the basis for the two concrete classes that hold whole ;TI" numbers, Bignum and Fixnum.;T; I"numeric.c;T; 0; 0; 0[[[[[I" class;T[[: public[[I"each_prime;FI"lib/prime.rb;T[I"from_prime_division;F@1[:protected[[: private[[I" instance;T[[; [![I" ceil;TI"numeric.c;T[I"chr;T@?[I"denominator;TI"rational.c;T[I" downto;T@?[I" even?;T@?[I" floor;T@?[I"gcd;T@D[I" gcdlcm;T@D[I" integer?;T@?[I"lcm;T@D[I" next;T@?[I"numerator;T@D[I" odd?;T@?[I"ord;T@?[I" pred;T@?[I" prime?;F@1[I"prime_division;F@1[I"rationalize;T@D[I" round;T@?[I" succ;T@?[I" times;T@?[I" to_bn;FI""ext/openssl/lib/openssl/bn.rb;T[I" to_d;FI"*ext/bigdecimal/lib/bigdecimal/util.rb;T[I" to_i;T@?[I" to_int;T@?[I" to_r;T@D[I" truncate;T@?[I" upto;T@?[;[[;[[[U:RDoc::Context::Section[i0o;;[; 0; 0[ @@@@%I"rational.c;T@cRDoc::TopLevelPK` ]ꃮaatry_convert-c.rinu[U:RDoc::AnyMethod[iI"try_convert:ETI"Integer::try_convert;TT: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"9If +object+ is an \Integer object, returns +object+.;To:RDoc::Markup::Verbatim; [I"#Integer.try_convert(1) # => 1 ;T: @format0o; ; [I"9Otherwise if +object+ responds to :to_int, ;TI"9calls object.to_int and returns the result.;To; ; [I"&Integer.try_convert(1.25) # => 1 ;T; 0o; ; [I"CReturns +nil+ if +object+ does not respond to :to_int;To; ; [I"&Integer.try_convert([]) # => nil ;T; 0o; ; [I"RRaises an exception unless object.to_int returns an \Integer object.;T: @fileI"numeric.rb;T:0@omit_headings_from_table_of_contents_below0I" object, integer, or nil ;T0[I" (num);T@!FI" Integer;TcRDoc::NormalClass00PK` ]\1==chr-i.rinu[U:RDoc::AnyMethod[iI"chr:ETI"Integer#chr;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"PReturns a string containing the character represented by the +int+'s value ;TI"according to +encoding+.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"65.chr #=> "A" ;TI"230.chr #=> "\346" ;TI".255.chr(Encoding::UTF_8) #=> "\303\277";T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"%int.chr([encoding]) -> string ;T0[I" (*args);T@FI" Integer;TcRDoc::NormalClass00PK` ]ae inspect-i.rinu[U:RDoc::AnyMethod[iI" inspect:ETI"Integer#inspect;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"JReturns a string containing the place-value representation of +self+ ;TI" in radix +base+ (in 2..36).;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"+12345.to_s # => "12345" ;TI"412345.to_s(2) # => "11000000111001" ;TI"+12345.to_s(8) # => "30071" ;TI"+12345.to_s(10) # => "12345" ;TI"*12345.to_s(16) # => "3039" ;TI")12345.to_s(36) # => "9ix" ;TI"/78546939656932.to_s(36) # => "rubyrules" ;T: @format0o; ; [I"3Raises an exception if +base+ is out of range.;T@o; ; [I"2Integer#inspect is an alias for Integer#to_s.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below000[I" (*args);T@FI" Integer;TcRDoc::NormalClass0[@"FI" to_s;TPK` ] fdiv-i.rinu[U:RDoc::AnyMethod[iI" fdiv:ETI"Integer#fdiv;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I">Returns the Float result of dividing +self+ by +numeric+:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"4.fdiv(2) # => 2.0 ;TI"4.fdiv(-2) # => -2.0 ;TI"-4.fdiv(2) # => -2.0 ;TI"4.fdiv(2.0) # => 2.0 ;TI"84.fdiv(Rational(3, 4)) # => 5.333333333333333 ;T: @format0o; ; [I"ERaises an exception if +numeric+ cannot be converted to a Float.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"fdiv(numeric) -> float ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]ttDDgcd-i.rinu[U:RDoc::AnyMethod[iI"gcd:ETI"Integer#gcd;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"FReturns the greatest common divisor (always positive). 0.gcd(x) ;TI" and x.gcd(0) return abs(x).;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"'2.gcd(2) #=> 2 ;TI"'3.gcd(-7) #=> 1 ;TI"&((1<<31)-1).gcd((1<<61)-1) #=> 1;T: @format0: @fileI"rational.c;T:0@omit_headings_from_table_of_contents_below0I" int.gcd(int2) -> integer ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]7rationalize-i.rinu[U:RDoc::AnyMethod[iI"rationalize:ETI"Integer#rationalize;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"DReturns the value as a rational. The optional argument eps is ;TI"always ignored.;T: @fileI"rational.c;T:0@omit_headings_from_table_of_contents_below0I"*int.rationalize([eps]) -> rational ;T0[I"(p1 = v1);T@FI" Integer;TcRDoc::NormalClass00PK` ]tp to_bn-i.rinu[U:RDoc::AnyMethod[iI" to_bn:EFI"Integer#to_bn;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"'Casts an Integer as an OpenSSL::BN;To:RDoc::Markup::BlankLineo; ; [I" See `man bn` for more info.;T: @fileI""ext/openssl/lib/openssl/bn.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]magnitude-i.rinu[U:RDoc::AnyMethod[iI"magnitude:ETI"Integer#magnitude;TF: privateo:RDoc::Markup::Document: @parts[: @fileI"numeric.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@ FI" Integer;TcRDoc::NormalClass0[@FI"abs;TPK` ] coerce-i.rinu[U:RDoc::AnyMethod[iI" coerce:ETI"Integer#coerce;TF: privateo: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::BlankLineo; ; [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" Integer;TcRDoc::NormalClass00PK` ]! to_i-i.rinu[U:RDoc::AnyMethod[iI" to_i:ETI"Integer#to_i;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RAs +int+ is already an Integer, all these methods simply return the receiver.;To:RDoc::Markup::BlankLineo; ; [I"4Synonyms are #to_int, #floor, #ceil, #truncate.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"int.to_i -> integer;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]}%26-i.rinu[U:RDoc::AnyMethod[iI"&:ETI"Integer#&;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"IBitwise AND; each bit in the result is 1 if both corresponding bits ;TI".in +self+ and +other+ are 1, 0 otherwise:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I","%04b" % (0b0101 & 0b0110) # => "0100" ;T: @format0o; ; [I"7Raises an exception if +other+ is not an \Integer.;T@o; ; [I"GRelated: Integer#| (bitwise OR), Integer#^ (bitwise EXCLUSIVE OR).;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"self & other -> integer ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]jSS%2a-i.rinu[U:RDoc::AnyMethod[iI"*:ETI"Integer#*;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Performs multiplication:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"4 * 2 # => 8 ;TI" 4 * -2 # => -8 ;TI" -4 * 2 # => -8 ;TI"!4 * 2.0 # => 8.0 ;TI"#4 * Rational(1, 3) # => (4/3) ;TI"#4 * Complex(2, 0) # => (8+0i);T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"&self * numeric -> numeric_result ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ] %3e%3e-i.rinu[U:RDoc::AnyMethod[iI">>:ETI"Integer#>>;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"FReturns +self+ with bits shifted +count+ positions to the right, ;TI"+or to the left if +count+ is negative:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"n = 0b11110000 ;TI"("%08b" % (n >> 1) # => "01111000" ;TI"("%08b" % (n >> 3) # => "00011110" ;TI")"%08b" % (n >> -1) # => "111100000" ;TI"+"%08b" % (n >> -3) # => "11110000000" ;T: @format0o; ; [I"Related: Integer#<<.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"self >> count -> integer ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]*div-i.rinu[U:RDoc::AnyMethod[iI"div:ETI"Integer#div;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"NPerforms integer division; returns the integer result of dividing +self+ ;TI"by +numeric+:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I" 4.div(3) # => 1 ;TI" 4.div(-3) # => -2 ;TI" -4.div(3) # => -2 ;TI" -4.div(-3) # => 1 ;TI" 4.div(3.0) # => 1 ;TI") 4.div(Rational(3, 1)) # => 1 ;TI" ;TI"ARaises an exception if +numeric+ does not have method +div+.;T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"div(numeric) -> integer ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]Q11 to_d-i.rinu[U:RDoc::AnyMethod[iI" to_d:EFI"Integer#to_d;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"1Convert +int+ to a BigDecimal and return it.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"require 'bigdecimal' ;TI"require 'bigdecimal/util' ;TI" ;TI" 42.to_d ;TI"0# => #;T: @format0: @fileI"*ext/bigdecimal/lib/bigdecimal/util.rb;T:0@omit_headings_from_table_of_contents_below0I"int.to_d -> bigdecimal ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ].ƚ %3c%3d-i.rinu[U:RDoc::AnyMethod[iI"<=:ETI"Integer#<=;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"DReturns +true+ if the value of +self+ is less than or equal to ;TI"that of +other+:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"$1 <= 0 # => false ;TI"#1 <= 1 # => true ;TI"#1 <= 2 # => true ;TI"$1 <= 0.5 # => false ;TI"$1 <= Rational(1, 2) # => false ;T: @format0o; ; [I":Raises an exception if the comparison cannot be made.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"#self <= real -> true or false ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]h4,,nobits%3f-i.rinu[U:RDoc::AnyMethod[iI" nobits?:ETI"Integer#nobits?;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"9Returns +true+ if no bit that is set (=1) in +mask+ ;TI"6is also set in +self+; returns +false+ otherwise.;To:RDoc::Markup::BlankLineo; ; [I"Example values:;T@o:RDoc::Markup::Verbatim; [I"0b11110000 self ;TI"0b00001111 mask ;TI"0b00000000 self & mask ;TI"$ true self.nobits?(mask) ;TI" ;TI"0b00000001 self ;TI"0b11111111 mask ;TI"0b00000001 self & mask ;TI"$ false self.nobits?(mask) ;T: @format0o; ; [I"1Related: Integer#allbits?, Integer#anybits?.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"$nobits?(mask) -> true or false ;T0[I" (p1);T@!FI" Integer;TcRDoc::NormalClass00PK` ]^¿ %3e%3d-i.rinu[U:RDoc::AnyMethod[iI">=:ETI"Integer#>=;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"GReturns +true+ if the value of +self+ is greater than or equal to ;TI"that of +other+:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"#1 >= 0 # => true ;TI"#1 >= 1 # => true ;TI"$1 >= 2 # => false ;TI"#1 >= 0.5 # => true ;TI"#1 >= Rational(1, 2) # => true ;T: @format0o; ; [I":Raises an exception if the comparison cannot be made.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"#self >= real -> true or false ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]J size-i.rinu[U:RDoc::AnyMethod[iI" size:ETI"Integer#size;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I""Document-method: Integer#size;To:RDoc::Markup::BlankLineo; ; [I"HReturns the number of bytes in the machine representation of +int+ ;TI"(machine dependent).;T@o:RDoc::Markup::Verbatim; [ I" 1.size #=> 8 ;TI" -1.size #=> 8 ;TI" 2147483647.size #=> 8 ;TI"!(256**10 - 1).size #=> 10 ;TI"!(256**20 - 1).size #=> 20 ;TI" (256**40 - 1).size #=> 40;T: @format0: @fileI"numeric.rb;T:0@omit_headings_from_table_of_contents_below0I"int.size -> int ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]3Se truncate-i.rinu[U:RDoc::AnyMethod[iI" truncate:ETI"Integer#truncate;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RAs +int+ is already an Integer, all these methods simply return the receiver.;To:RDoc::Markup::BlankLineo; ; [I"4Synonyms are #to_int, #floor, #ceil, #truncate.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"int.to_i -> integer ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]{Bm%3e-i.rinu[U:RDoc::AnyMethod[iI">:ETI"Integer#>;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"KReturns +true+ if the value of +self+ is greater than that of +other+:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"$ 1 > 0 # => true ;TI"% 1 > 1 # => false ;TI"% 1 > 2 # => false ;TI"$ 1 > 0.5 # => true ;TI"$ 1 > Rational(1, 2) # => true ;TI" ;TI":Raises an exception if the comparison cannot be made.;T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"#self > other -> true or false ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]d pred-i.rinu[U:RDoc::AnyMethod[iI" pred:ETI"Integer#pred;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I",Returns the Integer equal to +int+ - 1.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"1.pred #=> 0 ;TI"(-1).pred #=> -2;T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"int.pred -> integer ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]Xլ %2a%2a-i.rinu[U:RDoc::AnyMethod[iI"**:ETI"Integer#**;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"-Raises +self+ to the power of +numeric+:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I" 2 ** 3 # => 8 ;TI"$2 ** -3 # => (1/8) ;TI"!-2 ** 3 # => -8 ;TI"%-2 ** -3 # => (-1/8) ;TI"02 ** 3.3 # => 9.849155306759329 ;TI"$2 ** Rational(3, 1) # => (8/1) ;TI"$2 ** Complex(3, 0) # => (8+0i);T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"'self ** numeric -> numeric_result ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]̔%  %2f-i.rinu[U:RDoc::AnyMethod[iI"/:ETI"Integer#/;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RPerforms division; for integer +numeric+, truncates the result to an integer:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I" 4 / 3 # => 1 ;TI"! 4 / -3 # => -2 ;TI"! -4 / 3 # => -2 ;TI" -4 / -3 # => 1 ;TI" ;TI"6For other +numeric+, returns non-integer result: ;TI" ;TI"1 4 / 3.0 # => 1.3333333333333333 ;TI"$ 4 / Rational(3, 1) # => (4/3) ;TI"( 4 / Complex(3, 0) # => ((4/3)+0i);T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"&self / numeric -> numeric_result ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]Wg sqrt-c.rinu[U:RDoc::AnyMethod[iI" sqrt:ETI"Integer::sqrt;TT: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"FReturns the integer square root of the non-negative integer +n+, ;TI"Iwhich is the largest non-negative integer less than or equal to the ;TI"square root of +numeric+.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I""Integer.sqrt(0) # => 0 ;TI""Integer.sqrt(1) # => 1 ;TI""Integer.sqrt(24) # => 4 ;TI""Integer.sqrt(25) # => 5 ;TI"(Integer.sqrt(10**400) # => 10**200 ;T: @format0o; ; [I"EIf +numeric+ is not an \Integer, it is converted to an \Integer:;T@o; ; [ I")Integer.sqrt(Complex(4, 0)) # => 2 ;TI")Integer.sqrt(Rational(4, 1)) # => 2 ;TI")Integer.sqrt(4.0) # => 2 ;TI")Integer.sqrt(3.14159) # => 1 ;T; 0o; ; [I"EThis method is equivalent to Math.sqrt(numeric).floor, ;TI"Nexcept that the result of the latter code may differ from the true value ;TI"?due to the limited precision of floating point arithmetic.;T@o; ; [I";Integer.sqrt(10**46) # => 100000000000000000000000 ;TI":Math.sqrt(10**46).floor # => 99999999999999991611392 ;T; 0o; ; [I"2Raises an exception if +numeric+ is negative.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"&Integer.sqrt(numeric) -> integer ;T0[I" (p1);T@-FI" Integer;TcRDoc::NormalClass00PK` ]U% upto-i.rinu[U:RDoc::AnyMethod[iI" upto:ETI"Integer#upto;TF: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"NIterates the given block, passing in integer values from +int+ up to and ;TI"including +limit+.;To:RDoc::Markup::BlankLineo; ; [I"=If no block is given, an Enumerator is returned instead.;T@o; ; [I"For example:;T@o:RDoc::Markup::Verbatim; [I"%5.upto(10) { |i| print i, " " } ;TI"#=> 5 6 7 8 9 10;T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"\int.upto(limit) {|i| block } -> self int.upto(limit) -> an_enumerator ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]p %5b%5d-i.rinu[U:RDoc::AnyMethod[iI"[]:ETI"Integer#[];TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I")Returns a slice of bits from +self+.;To:RDoc::Markup::BlankLineo; ; [I"BWith argument +offset+, returns the bit at the given offset, ;TI"8where offset 0 refers to the least significant bit:;T@o:RDoc::Markup::Verbatim; [ I"n = 0b10 # => 2 ;TI"n[0] # => 0 ;TI"n[1] # => 1 ;TI"n[2] # => 0 ;TI"n[3] # => 0 ;T: @format0o; ; [I"QIn principle, n[i] is equivalent to (n >> i) & 1. ;TI".Thus, negative index always returns zero:;T@o; ; [I"255[-1] # => 0 ;T; 0o; ; [I"JWith arguments +offset+ and +size+, returns +size+ bits from +self+, ;TI"Fbeginning at +offset+ and including bits of greater significance:;T@o; ; [I" n = 0b111000 # => 56 ;TI"*"%010b" % n[0, 10] # => "0000111000" ;TI"*"%010b" % n[4, 10] # => "0000000011" ;T; 0o; ; [I"JWith argument +range+, returns range.size bits from +self+, ;TI"Rbeginning at range.begin and including bits of greater significance:;T@o; ; [I"n = 0b111000 # => 56 ;TI")"%010b" % n[0..9] # => "0000111000" ;TI")"%010b" % n[4..9] # => "0000000011" ;T; 0o; ; [I" 0 or 1 self[offset, size] -> integer self[range] -> integer ;T0[I" (*args);T@6FI" Integer;TcRDoc::NormalClass00PK` ] teeinteger%3f-i.rinu[U:RDoc::AnyMethod[iI" integer?:ETI"Integer#integer?;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"CSince +int+ is already an Integer, this always returns +true+.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"int.integer? -> true ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]3E22ord-i.rinu[U:RDoc::AnyMethod[iI"ord:ETI"Integer#ord;TF: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"Returns the +int+ itself.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"?a.ord #=> 97 ;T: @format0o; ; [I"MThis method is intended for compatibility to character constant in Ruby ;TI" 1.9.;T@o; ; [I"8For example, ?a.ord returns 97 both in 1.8 and 1.9.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"int.ord -> self ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]`) to_s-i.rinu[U:RDoc::AnyMethod[iI" to_s:ETI"Integer#to_s;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"JReturns a string containing the place-value representation of +self+ ;TI" in radix +base+ (in 2..36).;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"+12345.to_s # => "12345" ;TI"412345.to_s(2) # => "11000000111001" ;TI"+12345.to_s(8) # => "30071" ;TI"+12345.to_s(10) # => "12345" ;TI"*12345.to_s(16) # => "3039" ;TI")12345.to_s(36) # => "9ix" ;TI"/78546939656932.to_s(36) # => "rubyrules" ;T: @format0o; ; [I"3Raises an exception if +base+ is out of range.;T@o; ; [I"2Integer#inspect is an alias for Integer#to_s.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"!to_s(base = 10) -> string ;T0[[I" inspect;T@ I" (*args);T@FI" Integer;TcRDoc::NormalClass00PK` ]Пӝ%5e-i.rinu[U:RDoc::AnyMethod[iI"^:ETI"Integer#^;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"QBitwise EXCLUSIVE OR; each bit in the result is 1 if the corresponding bits ;TI"6in +self+ and +other+ are different, 0 otherwise:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I","%04b" % (0b0101 ^ 0b0110) # => "0011" ;T: @format0o; ; [I"7Raises an exception if +other+ is not an \Integer.;T@o; ; [I">Related: Integer#& (bitwise AND), Integer#| (bitwise OR).;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"self ^ other -> integer ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]2G next-i.rinu[U:RDoc::AnyMethod[iI" next:ETI"Integer#next;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"AReturns the Integer equal to +int+ + 1, same as Fixnum#next.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"1.next #=> 2 ;TI"(-1).next #=> 0;T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"int.next -> integer;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ] to_int-i.rinu[U:RDoc::AnyMethod[iI" to_int:ETI"Integer#to_int;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RAs +int+ is already an Integer, all these methods simply return the receiver.;To:RDoc::Markup::BlankLineo; ; [I"4Synonyms are #to_int, #floor, #ceil, #truncate.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"int.to_i -> integer ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]88numerator-i.rinu[U:RDoc::AnyMethod[iI"numerator:ETI"Integer#numerator;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Returns self.;T: @fileI"rational.c;T:0@omit_headings_from_table_of_contents_below0I"int.numerator -> self ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ] P %3c-i.rinu[U:RDoc::AnyMethod[iI"<:ETI"Integer#<;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HReturns +true+ if the value of +self+ is less than that of +other+:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"% 1 < 0 # => false ;TI"% 1 < 1 # => false ;TI"$ 1 < 2 # => true ;TI"% 1 < 0.5 # => false ;TI"% 1 < Rational(1, 2) # => false ;TI" ;TI":Raises an exception if the comparison cannot be made.;T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"#self < other -> true or false ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]0 divmod-i.rinu[U:RDoc::AnyMethod[iI" divmod:ETI"Integer#divmod;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"5Returns a 2-element array [q, r], where;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"*q = (self/other).floor # Quotient ;TI"+r = self % other # Remainder ;T: @format0o; ; [I"Examples:;T@o; ; [I"+11.divmod(4) # => [2, 3] ;TI"-11.divmod(-4) # => [-3, -1] ;TI",-11.divmod(4) # => [-3, 1] ;TI",-11.divmod(-4) # => [2, -3] ;TI" ;TI"+12.divmod(4) # => [3, 0] ;TI",12.divmod(-4) # => [-3, 0] ;TI",-12.divmod(4) # => [-3, 0] ;TI"+-12.divmod(-4) # => [3, 0] ;TI" ;TI"-13.divmod(4.0) # => [3, 1.0] ;TI".13.divmod(Rational(4, 1)) # => [3, (1/1)];T; 0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"divmod(other) -> array ;T0[I" (p1);T@$FI" Integer;TcRDoc::NormalClass00PK` ]< succ-i.rinu[U:RDoc::AnyMethod[iI" succ:ETI"Integer#succ;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"AReturns the Integer equal to +int+ + 1, same as Fixnum#next.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"1.next #=> 2 ;TI"(-1).next #=> 0;T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"int.succ -> integer;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]Ru[[ to_f-i.rinu[U:RDoc::AnyMethod[iI" to_f:ETI"Integer#to_f;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I" Converts +self+ to a Float:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"1.to_f # => 1.0 ;TI"-1.to_f # => -1.0 ;T: @format0o; ; [I"6If the value of +self+ does not fit in a \Float, ;TI"the result is infinity:;T@o; ; [I"#(10**400).to_f # => Infinity ;TI"#(-10**400).to_f # => -Infinity;T; 0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"to_f -> float ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]d•%7c-i.rinu[U:RDoc::AnyMethod[iI"|:ETI"Integer#|;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"IBitwise OR; each bit in the result is 1 if either corresponding bit ;TI",in +self+ or +other+ is 1, 0 otherwise:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I","%04b" % (0b0101 | 0b0110) # => "0111" ;T: @format0o; ; [I"7Raises an exception if +other+ is not an \Integer.;T@o; ; [I"HRelated: Integer#& (bitwise AND), Integer#^ (bitwise EXCLUSIVE OR).;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"self | other -> integer ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]ؿ  modulo-i.rinu[U:RDoc::AnyMethod[iI" modulo:ETI"Integer#modulo;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"4Returns +self+ modulo +other+ as a real number.;To:RDoc::Markup::BlankLineo; ; [I"KFor integer +n+ and real number +r+, these expressions are equivalent:;T@o:RDoc::Markup::Verbatim; [I" n % r ;TI"n-r*(n/r).floor ;TI"n.divmod(r)[1] ;T: @format0o; ; [I"See Numeric#divmod.;T@o; ; [I"Examples:;T@o; ; [I" 10 % 2 # => 0 ;TI" 10 % 3 # => 1 ;TI" 10 % 4 # => 2 ;TI" ;TI" 10 % -2 # => 0 ;TI"!10 % -3 # => -2 ;TI"!10 % -4 # => -2 ;TI" ;TI""10 % 3.0 # => 1.0 ;TI"$10 % Rational(3, 1) # => (1/1) ;T; 0o; ; [I".Integer#modulo is an alias for Integer#%.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@,FI" Integer;TcRDoc::NormalClass0[@/FI"%;TPK` ]BMM odd%3f-i.rinu[U:RDoc::AnyMethod[iI" odd?:ETI"Integer#odd?;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I".Returns +true+ if +int+ is an odd number.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"!int.odd? -> true or false ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ] 811anybits%3f-i.rinu[U:RDoc::AnyMethod[iI" anybits?:ETI"Integer#anybits?;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I":Returns +true+ if any bit that is set (=1) in +mask+ ;TI"6is also set in +self+; returns +false+ otherwise.;To:RDoc::Markup::BlankLineo; ; [I"Example values:;T@o:RDoc::Markup::Verbatim; [I"0b10000010 self ;TI"0b11111111 mask ;TI"0b10000010 self & mask ;TI"% true self.anybits?(mask) ;TI" ;TI"0b00000000 self ;TI"0b11111111 mask ;TI"0b00000000 self & mask ;TI"% false self.anybits?(mask) ;T: @format0o; ; [I"0Related: Integer#allbits?, Integer#nobits?.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"%anybits?(mask) -> true or false ;T0[I" (p1);T@!FI" Integer;TcRDoc::NormalClass00PK` ],}}%3d%3d%3d-i.rinu[U:RDoc::AnyMethod[iI"===:ETI"Integer#===;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"QReturns +true+ if +self+ is numerically equal to +other+; +false+ otherwise.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"1 == 2 #=> false ;TI"1 == 1.0 #=> true ;T: @format0o; ; [I"@Related: Integer#eql? (requires +other+ to be an \Integer).;T@o; ; [I",Integer#=== is an alias for Integer#==.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"$self == other -> true or false ;T0[[I"==;T@ I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]j@r// %2d%40-i.rinu[U:RDoc::AnyMethod[iI"-@:ETI"Integer#-@;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Returns +int+, negated.;T: @fileI"numeric.rb;T:0@omit_headings_from_table_of_contents_below0I"-int -> integer ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]!%7e-i.rinu[U:RDoc::AnyMethod[iI"~:ETI"Integer#~;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"BOne's complement: returns a number where each bit is flipped.;To:RDoc::Markup::BlankLineo; ; [ I"EInverts the bits in an Integer. As integers are conceptually of ;TI"Iinfinite length, the result acts as if it had an infinite number of ;TI"Eone bits to the left. In hex representations, this is displayed ;TI".as two periods to the left of the digits.;T@o:RDoc::Markup::Verbatim; [I"8sprintf("%X", ~0x1122334455) #=> "..FEEDDCCBBAA";T: @format0: @fileI"numeric.rb;T:0@omit_headings_from_table_of_contents_below0I"~int -> integer ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ].)^ ceil-i.rinu[U:RDoc::AnyMethod[iI" ceil:ETI"Integer#ceil;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RAs +int+ is already an Integer, all these methods simply return the receiver.;To:RDoc::Markup::BlankLineo; ; [I"4Synonyms are #to_int, #floor, #ceil, #truncate.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"int.to_i -> integer ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]T,LL%2b-i.rinu[U:RDoc::AnyMethod[iI"+:ETI"Integer#+;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Performs addition:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"2 + 2 # => 4 ;TI"-2 + 2 # => 0 ;TI" -2 + -2 # => -4 ;TI"!2 + 2.0 # => 4.0 ;TI"#2 + Rational(2, 1) # => (4/1) ;TI"#2 + Complex(2, 0) # => (4+0i);T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"&self + numeric -> numeric_result ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]Jccabs-i.rinu[U:RDoc::AnyMethod[iI"abs:ETI"Integer#abs;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I")Returns the absolute value of +int+.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"(-12345).abs #=> 12345 ;TI"-12345.abs #=> 12345 ;TI"12345.abs #=> 12345 ;T: @format0o; ; [I"3Integer#magnitude is an alias for Integer#abs.;T: @fileI"numeric.rb;T:0@omit_headings_from_table_of_contents_below0I";int.abs -> integer int.magnitude -> integer ;T0[[I"magnitude;To;; [;@;0I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]PP%2d-i.rinu[U:RDoc::AnyMethod[iI"-:ETI"Integer#-;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Performs subtraction:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"4 - 2 # => 2 ;TI" -4 - 2 # => -6 ;TI" -4 - -2 # => -2 ;TI"!4 - 2.0 # => 2.0 ;TI"#4 - Rational(2, 1) # => (2/1) ;TI"#4 - Complex(2, 0) # => (2+0i);T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"&self - numeric -> numeric_result ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]u digits-i.rinu[U:RDoc::AnyMethod[iI" digits:ETI"Integer#digits;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"@Returns an array of integers representing the +base+-radix ;TI"digits of +self+; ;TI"Kthe first element of the array represents the least significant digit:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I",12345.digits # => [5, 4, 3, 2, 1] ;TI",12345.digits(7) # => [4, 6, 6, 0, 5] ;TI"(12345.digits(100) # => [45, 23, 1] ;T: @format0o; ; [I"HRaises an exception if +self+ is negative or +base+ is less than 2.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I",digits(base = 10) -> array_of_integers ;T0[I" (*args);T@FI" Integer;TcRDoc::NormalClass00PK` ]OSJ::pow-i.rinu[U:RDoc::AnyMethod[iI"pow:ETI"Integer#pow;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I")Returns (modular) exponentiation as:;Fo:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"#a.pow(b) #=> same as a**b ;TI"Ja.pow(b, m) #=> same as (a**b) % m, but avoids huge temporary values;T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"[integer.pow(numeric) -> numeric integer.pow(integer, integer) -> integer ;F0[I" (*args);T@FI" Integer;TcRDoc::NormalClass00PK` ]!+G\\lcm-i.rinu[U:RDoc::AnyMethod[iI"lcm:ETI"Integer#lcm;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"HReturns the least common multiple (always positive). 0.lcm(x) and ;TI"x.lcm(0) return zero.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"'2.lcm(2) #=> 2 ;TI"(3.lcm(-7) #=> 21 ;TI"A((1<<31)-1).lcm((1<<61)-1) #=> 4951760154835678088235319297;T: @format0: @fileI"rational.c;T:0@omit_headings_from_table_of_contents_below0I" int.lcm(int2) -> integer ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ],~ %3c%3c-i.rinu[U:RDoc::AnyMethod[iI"<<:ETI"Integer#<<;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"EReturns +self+ with bits shifted +count+ positions to the left, ;TI",or to the right if +count+ is negative:;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [ I"n = 0b11110000 ;TI")"%08b" % (n << 1) # => "111100000" ;TI"+"%08b" % (n << 3) # => "11110000000" ;TI"("%08b" % (n << -1) # => "01111000" ;TI"("%08b" % (n << -3) # => "00011110" ;T: @format0o; ; [I"Related: Integer#>>.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"self << count -> integer ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]Zul floor-i.rinu[U:RDoc::AnyMethod[iI" floor:ETI"Integer#floor;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"RAs +int+ is already an Integer, all these methods simply return the receiver.;To:RDoc::Markup::BlankLineo; ; [I"4Synonyms are #to_int, #floor, #ceil, #truncate.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"int.to_i -> integer ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]^WW %3d%3d-i.rinu[U:RDoc::AnyMethod[iI"==:ETI"Integer#==;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"QReturns +true+ if +self+ is numerically equal to +other+; +false+ otherwise.;To:RDoc::Markup::BlankLineo:RDoc::Markup::Verbatim; [I"1 == 2 #=> false ;TI"1 == 1.0 #=> true ;T: @format0o; ; [I"@Related: Integer#eql? (requires +other+ to be an \Integer).;T@o; ; [I",Integer#=== is an alias for Integer#==.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below000[I" (p1);T@FI" Integer;TcRDoc::NormalClass0[@FI"===;TPK` ]D,,allbits%3f-i.rinu[U:RDoc::AnyMethod[iI" allbits?:ETI"Integer#allbits?;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I" true or false ;T0[I" (p1);T@!FI" Integer;TcRDoc::NormalClass00PK` ]e`PP zero%3f-i.rinu[U:RDoc::AnyMethod[iI" zero?:ETI"Integer#zero?;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I".Returns +true+ if +int+ has a zero value.;T: @fileI"numeric.rb;T:0@omit_headings_from_table_of_contents_below0I" int.zero? -> true or false ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]--%3c%3d%3e-i.rinu[U:RDoc::AnyMethod[iI"<=>:ETI"Integer#<=>;TF: privateo:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I" Returns:;To:RDoc::Markup::BlankLineo:RDoc::Markup::List: @type: BULLET: @items[ o:RDoc::Markup::ListItem: @label0; [o; ; [I"(-1, if +self+ is less than +other+.;To;;0; [o; ; [I"&0, if +self+ is equal to +other+.;To;;0; [o; ; [I"*1, if +self+ is greater then +other+.;To;;0; [o; ; [I"3+nil+, if +self+ and +other+ are incomparable.;T@o; ; [I"Examples:;T@o:RDoc::Markup::Verbatim; [ I""1 <=> 2 # => -1 ;TI"!1 <=> 1 # => 0 ;TI"!1 <=> 0 # => 1 ;TI"#1 <=> 'foo' # => nil ;TI" ;TI"!1 <=> 1.0 # => 0 ;TI"!1 <=> Rational(1, 1) # => 0 ;TI"!1 <=> Complex(1, 0) # => 0 ;T: @format0o; ; [I"CThis method is the basis for comparisons in module Comparable.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"+self <=> other -> -1, 0, +1, or nil ;T0[I" (p1);T@5FI" Integer;TcRDoc::NormalClass00PK` ]5QQ even%3f-i.rinu[U:RDoc::AnyMethod[iI" even?:ETI"Integer#even?;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"/Returns +true+ if +int+ is an even number.;T: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I""int.even? -> true or false ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]{t88denominator-i.rinu[U:RDoc::AnyMethod[iI"denominator:ETI"Integer#denominator;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"Returns 1.;T: @fileI"rational.c;T:0@omit_headings_from_table_of_contents_below0I"int.denominator -> 1 ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]dq downto-i.rinu[U:RDoc::AnyMethod[iI" downto:ETI"Integer#downto;TF: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"PIterates the given block, passing decreasing values from +int+ down to and ;TI"including +limit+.;To:RDoc::Markup::BlankLineo; ; [I"=If no block is given, an Enumerator is returned instead.;T@o:RDoc::Markup::Verbatim; [I"(5.downto(1) { |n| print n, ".. " } ;TI"print " Liftoff!\n" ;TI")#=> "5.. 4.. 3.. 2.. 1.. Liftoff!";T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"`int.downto(limit) {|i| block } -> self int.downto(limit) -> an_enumerator ;T0[I" (p1);T@FI" Integer;TcRDoc::NormalClass00PK` ]/" times-i.rinu[U:RDoc::AnyMethod[iI" times:ETI"Integer#times;TF: publico:RDoc::Markup::Document: @parts[ o:RDoc::Markup::Paragraph; [I"JIterates the given block +int+ times, passing in values from zero to ;TI"int - 1.;To:RDoc::Markup::BlankLineo; ; [I"=If no block is given, an Enumerator is returned instead.;T@o:RDoc::Markup::Verbatim; [ I"5.times do |i| ;TI" print i, " " ;TI" end ;TI"#=> 0 1 2 3 4;T: @format0: @fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0I"Pint.times {|i| block } -> self int.times -> an_enumerator ;T0[I"();T@FI" Integer;TcRDoc::NormalClass00PK` ]:bit_length-i.rinu[U:RDoc::AnyMethod[iI"bit_length:ETI"Integer#bit_length;TF: privateo:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"6Returns the number of bits of the value of +int+.;To:RDoc::Markup::BlankLineo; ; [ I"@"Number of bits" means the bit position of the highest bit ;TI"*which is different from the sign bit ;TI";(where the least significant bit has bit position 1). ;TI"CIf there is no such bit (zero or minus one), zero is returned.;T@o; ; [I"HI.e. this method returns ceil(log2(int < 0 ? -int : int+1)).;T@o:RDoc::Markup::Verbatim; [I"((-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 ;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.rb;T:0@omit_headings_from_table_of_contents_below0I"!int.bit_length -> integer ;T0[I"();T@9FI" Integer;TcRDoc::NormalClass00PK"`]H8νfrom_prime_division-c.rinu[U:RDoc::AnyMethod[iI"from_prime_division:EFI"!Integer::from_prime_division;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"?Re-composes a prime factorization and returns the product.;To:RDoc::Markup::BlankLineo; ; [I"8See Prime#int_from_prime_division for more details.;T: @fileI"lib/prime.rb;T:0@omit_headings_from_table_of_contents_below000[I" (pd);T@FI" Integer;TcRDoc::NormalClass00PK"`] II prime%3f-i.rinu[U:RDoc::AnyMethod[iI" prime?:EFI"Integer#prime?;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"EReturns true if +self+ is a prime number, false for a composite.;T: @fileI"lib/prime.rb;T:0@omit_headings_from_table_of_contents_below000[I"();T@FI" Integer;TcRDoc::NormalClass00PK"`]each_prime-c.rinu[U:RDoc::AnyMethod[iI"each_prime:EFI"Integer::each_prime;TT: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I"5Iterates the given block over all prime numbers.;To:RDoc::Markup::BlankLineo; ; [I"'See +Prime+#each for more details.;T: @fileI"lib/prime.rb;T:0@omit_headings_from_table_of_contents_below00I" prime;F[I" (ubound);T@FI" Integer;TcRDoc::NormalClass00PK"`])rțprime_division-i.rinu[U:RDoc::AnyMethod[iI"prime_division:EFI"Integer#prime_division;TF: publico:RDoc::Markup::Document: @parts[o:RDoc::Markup::Paragraph; [I")Returns the factorization of +self+.;To:RDoc::Markup::BlankLineo; ; [I"/See Prime#prime_division for more details.;T: @fileI"lib/prime.rb;T:0@omit_headings_from_table_of_contents_below000[I")(generator = Prime::Generator23.new);T@FI" Integer;TcRDoc::NormalClass00PK` ]j}}MM gcdlcm-i.rinu[PK` ]>%25-i.rinu[PK` ].S to_r-i.rinu[PK` ] D;remainder-i.rinu[PK` ]oe v round-i.rinu[PK` ]t++dcdesc-Integer.rinu[PK` ]ꃮaatry_convert-c.rinu[PK` ]\1==pchr-i.rinu[PK` ]ae inspect-i.rinu[PK` ] fdiv-i.rinu[PK` ]ttDD"gcd-i.rinu[PK` ]7%rationalize-i.rinu[PK` ]tp &to_bn-i.rinu[PK` ](magnitude-i.rinu[PK` ] )coerce-i.rinu[PK` ]! ,to_i-i.rinu[PK` ]}.%26-i.rinu[PK` ]jSS1%2a-i.rinu[PK` ]  4%3e%3e-i.rinu[PK` ]*6div-i.rinu[PK` ]Q11  :to_d-i.rinu[PK` ].ƚ v<%3c%3d-i.rinu[PK` ]h4,,o?nobits%3f-i.rinu[PK` ]^¿ B%3e%3d-i.rinu[PK` ]J Esize-i.rinu[PK` ]3Se Htruncate-i.rinu[PK` ]{BmJ%3e-i.rinu[PK` ]d Mpred-i.rinu[PK` ]Xլ O%2a%2a-i.rinu[PK` ]̔%  R%2f-i.rinu[PK` ]Wg Usqrt-c.rinu[PK` ]U% [upto-i.rinu[PK` ]p k^%5b%5d-i.rinu[PK` ] teedinteger%3f-i.rinu[PK` ]3E22Hford-i.rinu[PK` ]`) hto_s-i.rinu[PK` ]Пӝl%5e-i.rinu[PK` ]2G fonext-i.rinu[PK` ] lqto_int-i.rinu[PK` ]88ssnumerator-i.rinu[PK` ] P t%3c-i.rinu[PK` ]0 wdivmod-i.rinu[PK` ]< {succ-i.rinu[PK` ]Ru[[ ~to_f-i.rinu[PK` ]d•%7c-i.rinu[PK` ]ؿ  fmodulo-i.rinu[PK` ]BMM bodd%3f-i.rinu[PK` ] 811anybits%3f-i.rinu[PK` ],}}Z%3d%3d%3d-i.rinu[PK` ]j@r// %2d%40-i.rinu[PK` ]!%7e-i.rinu[PK` ].)^ ceil-i.rinu[PK` ]T,LL%2b-i.rinu[PK` ]Jccabs-i.rinu[PK` ]PP%2d-i.rinu[PK` ]u Bdigits-i.rinu[PK` ]OSJ::rpow-i.rinu[PK` ]!+G\\lcm-i.rinu[PK` ],~ x%3c%3c-i.rinu[PK` ]Zul ifloor-i.rinu[PK` ]^WW m%3d%3d-i.rinu[PK` ]D,,allbits%3f-i.rinu[PK` ]e`PP jzero%3f-i.rinu[PK` ]--%3c%3d%3e-i.rinu[PK` ]5QQ aeven%3f-i.rinu[PK` ]{t88denominator-i.rinu[PK` ]dq fdownto-i.rinu[PK` ]/" ktimes-i.rinu[PK` ]:2bit_length-i.rinu[PK"`]H8νfrom_prime_division-c.rinu[PK"`] II prime%3f-i.rinu[PK"`] each_prime-c.rinu[PK"`])rțprime_division-i.rinu[PKIIe