**Category: Language-Data types**

Superclass: Number- I represent rational numbers in the form (p/q) where p and q are integers. The arithmetic operations *, +, -, /, on fractions, all return a reduced fraction.

instance creation (class)

accessing (instance)

arithmetic (instance)

coercing (instance)

coercion (instance)

comparing (instance)

converting (instance)

optimized cases (instance)

printing (instance)

testing (instance)

Answer aNumber converted to a Fraction

Initialize the receiver's class variables

**numerator: nInteger denominator: dInteger**

Answer a new instance of fraction (nInteger/dInteger)

Answer the receiver's denominator

**numerator**

Answer the receiver's numerator

Multiply two numbers and answer the result.

**+ aNumber**

Sum two numbers and answer the result.

**- aNumber**

Subtract aNumber from the receiver and answer the result.

**/ aNumber**

Divide the receiver by aNumber and answer the result.

**// aNumber**

Return the integer quotient of dividing the receiver by aNumber with truncation towards negative infinity.

**\\ aNumber**

Return the remainder from dividing the receiver by aNumber, (using //).

**estimatedLog**

Answer an estimate of (self abs floorLog: 10)

Truncate the receiver towards positive infinity and return the truncated result

**coerce: aNumber**

Coerce aNumber to the receiver's class

**floor**

Truncate the receiver towards negative infinity and return the truncated result

**generality**

Return the receiver's generality

**truncated**

Truncate the receiver and return the truncated result

**unity**

Coerce 1 to the receiver's class

**zero**

Coerce 0 to the receiver's class

Convert the receiver to a kind of number that is understood by the C call-out mechanism.

Test if the receiver is less than arg.

**<= arg**

Test if the receiver is less than or equal to arg.

**= arg**

Test if the receiver equals arg.

**> arg**

Test if the receiver is more than arg.

**>= arg**

Test if the receiver is greater than or equal to arg.

**hash**

Answer an hash value for the receiver

Answer the receiver, it is already a Fraction

**asFloatD**

Answer the receiver converted to a FloatD

**asFloatE**

Answer the receiver converted to a FloatD

**asFloatQ**

Answer the receiver converted to a FloatD

**asFraction**

Answer the receiver, it is already a Fraction

**integerPart**

Answer the integer part of the receiver, expressed as a Fraction

Return the receiver, with its sign changed.

**raisedToInteger: anInteger**

Return self raised to the anInteger-th power.

**reciprocal**

Return the reciprocal of the receiver

**sqrt**

Return the square root of the receiver.

**squared**

Return the square of the receiver.

Print a representation of the receiver on aStream

**storeOn: aStream**

Store Smalltalk code compiling to the receiver on aStream

Answer whether the receiver is rational - true