Class: Bignum
- Inherits:
-
Object
- Object
- Bignum
- Defined in:
- lib/rational.rb,
lib/rational.rb
Instance Method Summary collapse
-
#quo(other) ⇒ Object
(also: #rdiv)
If Rational is defined, returns a Rational number instead of a Float.
-
#rpower(other) ⇒ Object
(also: #**)
Returns a Rational number if the result is in fact rational (i.e.
other< 0).
Instance Method Details
#quo(other) ⇒ Object Also known as: rdiv
If Rational is defined, returns a Rational number instead of a Float.
539 540 541 |
# File 'lib/rational.rb', line 539 def quo(other) Rational.new!(self, 1) / other end |
#rpower(other) ⇒ Object Also known as: **
Returns a Rational number if the result is in fact rational (i.e. other < 0).
545 546 547 548 549 550 551 |
# File 'lib/rational.rb', line 545 def rpower (other) if other >= 0 self.power!(other) else Rational.new!(self, 1)**other end end |