Extended maintenance of Ruby versions 1.8.7 and 1.9.2 ended on July 31, 2014. Read more

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
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus