In Files

  • complex.rb

Class/Module Index [+]

Quicksearch

Integer

Public Instance Methods

denominator() click to toggle source
 
               # File complex.rb, line 418
def denominator() 1 end
            
gcd(other) click to toggle source
 
               # File complex.rb, line 420
def gcd(other)
  min = self.abs
  max = other.abs
  while min > 0
    tmp = min
    min = max % min
    max = tmp
  end
  max
end
            
lcm(other) click to toggle source
 
               # File complex.rb, line 431
def lcm(other)
  if self.zero? or other.zero?
    0
  else
    (self.div(self.gcd(other)) * other).abs
  end
end
            
numerator() click to toggle source
 
               # File complex.rb, line 417
def numerator() self end