Io Reference







Math   /   Rational   /   Rational





 
 
 



!=(other)

Compares two numbers against one another. Returns true if they are equal (represent the same number), false otherwise.
%(aNum)

Returns the receiver modulus aNum
*(aNum)

Returns the value of the receiver multiplied by aNum.
+(aNum)

Returns the value of the receiver added to aNum.
-(aNum)

Returns the value of the receiver subtracted from aNum.
/(aNum)

Returns the value of the receiver divided by aNum.
==(other)

Compares two numbers against one another. Returns true if they are equal (represent the same number), false otherwise.
abs

Returns a Rational number with the absolute value of the receiver.
asNumber

Converts the Rational number to a floating point number.
asRational

Converts the number to a Rational number. CAVEAT: Numbers in Io are floating point entities, which means since they are imprecise, this conversion may yield values not expected.")
asString

Returns a text string representing the Rational number.
compare(other)

Compares two numbers against one another. Returns a positive, zero or negative value based on whether the receiver is larger, equal or less than the argument.
denominator

Returns the denominator.
divmod(aNum)

Returns a list containing the integer value and the receiver modulus aNum.
gcd(aNum)

Calculates the greatest common denominator between the receiver and the argument.
negate

Negates the Rational number.
numerator

Returns the numerator.
pow(aNum)

Returns the value of the receiver to the power of aNum.
reduce

Reduces the numerator and denominator to their lowest terms.
serialized

Returns a bit of code which can be used to serialize the Rational number.
setDenominator(aNumber)

Sets the denominator. Returns self.
setNumerator(aNumber)

Sets the numerator. Returns self.
with(aNumerator, aDenominator)

Convenience constructor. Returns a new Rational number whose numerator and denominator are represented by the arguments aNumerator and aDenominator respectively.")