Class: Bignum

Inherits:
Object
  • Object
show all
Defined in:
lib/rational.rb

Instance Method Summary collapse

Instance Method Details

#quo(other) ⇒ Object Also known as: rdiv

If Rational is defined, returns a Rational number instead of a Bignum.


513
514
515
# File 'lib/rational.rb', line 513

def quo(other)
  Rational.new!(self,1) / other
end

#rpower(other) ⇒ Object

Returns a Rational number if the result is in fact rational (i.e. other < 0).


519
520
521
522
523
524
525
# File 'lib/rational.rb', line 519

def rpower (other)
  if other >= 0
    self.power!(other)
  else
    Rational.new!(self, 1)**other
  end
end