ÿØÿà JFIF ÿÛ „ ( %!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
ÿØÿà JFIF ÿÛ „
(
%!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ
ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ
ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ
? ¼QxJQaÍuò¸Zö
Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
????????????????????????????????????
????????????????????????????????????
ÿØÿà JFIF ÿÛ „ ( %!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
ÿØÿà JFIF ÿÛ „
(
%!1!%)+//.383,7(-.+
-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ ¥2" ÿÄ
ÿÄ J ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ
ÿÄ * !1AQa‘"2q3±ð#b¡ÿÚ
? ¼QxJQaÍuò¸Zö
Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁTÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßwpŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
?>
.........................................
.............................................................................
????????????????????????????????????
????????????????????????????????????
U:RDoc::NormalClass[iI"Numeric:ET@I"Object;To:RDoc::Markup::Document:@parts[o;;[(o:RDoc::Markup::Paragraph;[I"V\Numeric is the class from which all higher-level numeric classes should inherit.;To:RDoc::Markup::BlankLine o; ;[I"a\Numeric allows instantiation of heap-allocated objects. Other core numeric classes such as ;TI"`Integer are implemented as immediates, which means that each Integer is a single immutable ;TI",object which is always passed by value.;T@o:RDoc::Markup::Verbatim;[I"a = 1
;TI"+1.object_id == a.object_id #=> true
;T:@format0o; ;[I"\There can only ever be one instance of the integer +1+, for example. Ruby ensures this ;TI"]by preventing instantiation. If duplication is attempted, the same instance is returned.;T@o;;[I"bInteger.new(1) #=> NoMethodError: undefined method `new' for Integer:Class
;TI",1.dup #=> 1
;TI"/1.object_id == 1.dup.object_id #=> true
;T;0o; ;[I"RFor this reason, \Numeric should be used when defining other numeric classes.;T@o; ;[I"]Classes which inherit from \Numeric must implement +coerce+, which returns a two-member ;TI"XArray containing an object that has been coerced into an instance of the new class ;TI"and +self+ (see #coerce).;T@o; ;[ I"[Inheriting classes should also implement arithmetic operator methods (+, ;TI"_-, * and /) and the <=> operator (see ;TI"UComparable). These methods may rely on +coerce+ to ensure interoperability with ;TI"(instances of other numeric classes.;T@o;;[.I"class Tally < Numeric
;TI" def initialize(string)
;TI" @string = string
;TI" end
;TI"
;TI" def to_s
;TI" @string
;TI" end
;TI"
;TI" def to_i
;TI" @string.size
;TI" end
;TI"
;TI" def coerce(other)
;TI"2 [self.class.new('|' * other.to_i), self]
;TI" end
;TI"
;TI" def <=>(other)
;TI" to_i <=> other.to_i
;TI" end
;TI"
;TI" def +(other)
;TI"3 self.class.new('|' * (to_i + other.to_i))
;TI" end
;TI"
;TI" def -(other)
;TI"3 self.class.new('|' * (to_i - other.to_i))
;TI" end
;TI"
;TI" def *(other)
;TI"3 self.class.new('|' * (to_i * other.to_i))
;TI" end
;TI"
;TI" def /(other)
;TI"3 self.class.new('|' * (to_i / other.to_i))
;TI" end
;TI" end
;TI"
;TI"tally = Tally.new('||')
;TI"*puts tally * 2 #=> "||||"
;TI"(puts tally > 1 #=> true
;T;0S:RDoc::Markup::Heading:
leveli: textI"What's Here;T@o; ;[I".First, what's elsewhere. \Class \Numeric:;T@o:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o; ;[I"AInherits from {class Object}[rdoc-ref:Object@What-27s+Here].;To;;0;[o; ;[I"EIncludes {module Comparable}[rdoc-ref:Comparable@What-27s+Here].;T@o; ;[I"/Here, class \Numeric provides methods for:;T@o;;;;[ o;;0;[o; ;[I"*{Querying}[rdoc-ref:Numeric@Querying];To;;0;[o; ;[I",{Comparing}[rdoc-ref:Numeric@Comparing];To;;0;[o; ;[I".{Converting}[rdoc-ref:Numeric@Converting];To;;0;[o; ;[I"${Other}[rdoc-ref:Numeric@Other];T@S;
;i;I"
Querying;T@o;;;;[
o;;0;[o; ;[I"F#finite?: Returns true unless +self+ is infinite or not a number.;To;;0;[o; ;[I"F#infinite?: Returns -1, +nil+ or +1, depending on whether +self+ ;TI"9is -Infinity, finite, or +Infinity.;To;;0;[o; ;[I"5#integer?: Returns whether +self+ is an integer.;To;;0;[o; ;[I"4#negative?: Returns whether +self+ is negative.;To;;0;[o; ;[I"3#nonzero?: Returns whether +self+ is not zero.;To;;0;[o; ;[I"4#positive?: Returns whether +self+ is positive.;To;;0;[o; ;[I"4#real?: Returns whether +self+ is a real value.;To;;0;[o; ;[I",#zero?: Returns whether +self+ is zero.;T@S;
;i;I"Comparing;T@o;;;;[o;;0;[o; ;[I"#<=>: Returns:;T@o;;;;[ o;;0;[o; ;[I"0-1 if +self+ is less than the given value.;To;;0;[o; ;[I"-0 if +self+ is equal to the given value.;To;;0;[o; ;[I"11 if +self+ is greater than the given value.;To;;0;[o; ;[I"<+nil+ if +self+ and the given value are not comparable.;T@o;;0;[o; ;[I"T#eql?: Returns whether +self+ and the given value have the same value and type.;T@S;
;i;I"Converting;T@o;;;;[o;;0;[o; ;[I"Y#% (aliased as #modulo): Returns the remainder of +self+ divided by the given value.;To;;0;[o; ;[I"/#-@: Returns the value of +self+, negated.;To;;0;[o; ;[I"H#abs (aliased as #magnitude): Returns the absolute value of +self+.;To;;0;[o; ;[I")#abs2: Returns the square of +self+.;To;;0;[o; ;[I"K#angle (aliased as #arg and #phase): Returns 0 if +self+ is positive, ;TI"Math::PI otherwise.;To;;0;[o; ;[I"I#ceil: Returns the smallest number greater than or equal to +self+, ;TI"to a given precision.;To;;0;[o; ;[I"C#coerce: Returns array [coerced_self, coerced_other] ;TI"for the given other value.;To;;0;[o; ;[I"L#conj (aliased as #conjugate): Returns the complex conjugate of +self+.;To;;0;[o; ;[I"=#denominator: Returns the denominator (always positive) ;TI".of the Rational representation of +self+.;To;;0;[o; ;[I"B#div: Returns the value of +self+ divided by the given value ;TI"!and converted to an integer.;To;;0;[o; ;[I"C#divmod: Returns array [quotient, modulus] resulting ;TI",from dividing +self+ the given divisor.;To;;0;[o; ;[I"M#fdiv: Returns the Float result of dividing +self+ by the given divisor.;To;;0;[o; ;[I"F#floor: Returns the largest number less than or equal to +self+, ;TI"to a given precision.;To;;0;[o; ;[I"?#i: Returns the Complex object Complex(0, self). ;TI"the given value.;To;;0;[o; ;[I"M#imaginary (aliased as #imag): Returns the imaginary part of the +self+.;To;;0;[o; ;[I"Q#numerator: Returns the numerator of the Rational representation of +self+; ;TI"!has the same sign as +self+.;To;;0;[o; ;[I"=#polar: Returns the array [self.abs, self.arg].;To;;0;[o; ;[I"B#quo: Returns the value of +self+ divided by the given value.;To;;0;[o; ;[I",#real: Returns the real part of +self+.;To;;0;[o; ;[I"K#rect (aliased as #rectangular): Returns the array [self, 0].;To;;0;[o; ;[I"S#remainder: Returns self-arg*(self/arg).truncate for the given +arg+.;To;;0;[o; ;[I"F#round: Returns the value of +self+ rounded to the nearest value ;TI"for the given a precision.;To;;0;[o; ;[I"9#to_c: Returns the Complex representation of +self+.;To;;0;[o; ;[I"T#to_int: Returns the Integer representation of +self+, truncating if necessary.;To;;0;[o; ;[I"L#truncate: Returns +self+ truncated (toward zero) to a given precision.;T@S;
;i;I"
Other;T@o;;;;[o;;0;[o; ;[I"5#clone: Returns +self+; does not allow freezing.;To;;0;[o; ;[I"+#dup (aliased as #+@): Returns +self+.;To;;0;[o; ;[I"K#step: Invokes the given block with the sequence of specified numbers.;T:
@fileI"numeric.c;T:0@omit_headings_from_table_of_contents_below0o;;[ ;I"numeric.rb;T;0;0;0[ [ [[I"Comparable;To;;[ ;@p;0I"numeric.c;T[[I"
class;T[[:public[ [:protected[ [:private[ [I"
instance;T[[;[3[I"%;T@{[I"+@;TI"numeric.rb;T[I"-@;T@{[I"<=>;T@{[I"abs;T@{[I" abs2;TI"complex.c;T[I"
angle;T@[I"arg;T@[I" ceil;T@{[I"
clone;T@{[I"coerce;T@{[I" conj;T@[I"conjugate;T@[I"denominator;TI"rational.c;T[I"div;T@{[I"divmod;T@{[I"dup;T@[I" eql?;T@{[I" fdiv;T@{[I"finite?;T@[I"
floor;T@{[I"i;T@{[I" imag;T@[I"imaginary;T@[I"infinite?;T@[I"
integer?;T@[I"magnitude;T@{[I"modulo;T@{[I"negative?;T@{[I"
nonzero?;T@{[I"numerator;T@[I"
phase;T@[I"
polar;T@[I"positive?;T@{[I"quo;T@[I" real;T@[I"
real?;T@[I" rect;T@[I"rectangular;T@[I"remainder;T@{[I"
round;T@{[I" step;T@{[I" to_c;T@[I"to_int;T@{[I"
truncate;T@{[I"
zero?;T@{[;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ;0;0[ I"complex.c;T@p@sI"rational.c;T@cRDoc::TopLevel