| kind | = | "Number Rational" |
A rational number is either an integer or a ratio
- *(multiplier)
- **(exponent)
- +(addend)
- -(subtrahend)
- /(dividend)
- <=>(other)
- ==(other)
- ===(other)
- asText()
- inspect()
- notice()
- sqrt()
returns the product of this number and the argument. if the argument is a decimal, the receiver will be converted into a form suitable for multiplying against a decimal, and then multiplied. if the argument is neither a Rational nor a Decimal, it tries to call asRational, and if that fails it signals a condition.
returns the addition of this number and the argument. if the argument is a decimal, the receiver will be converted into a form suitable for addition against a decimal, and then added. if the argument is neither a Rational nor a Decimal, it tries to call asRational, and if that fails it signals a condition.
returns the difference between this number and the argument. if the argument is a decimal, the receiver will be converted into a form suitable for subtracting against a decimal, and then subtracted. if the argument is neither a Rational nor a Decimal, it tries to call asRational, and if that fails it signals a condition.
returns the quotient of this number and the argument. if the division is not exact, it will return a Ratio.
compares this number against the argument, returning -1, 0 or 1 based on which one is larger. if the argument is a decimal, the receiver will be converted into a form suitable for comparing against a decimal, and then compared - it's not specified whether this will actually call Decimal#<=> or not. if the argument is neither a Rational nor a Decimal, it tries to call asRational, and if that doesn't work it returns nil.
compares this number against the argument, true if this number is the same, otherwise false
nil
[ show source ]
method(other,
if(self same?(
0),
Reflector other:mimics?(cell(:other),
0),
bind(rescue(Condition Error, fn(c, false)),
self ==(
other))))