Class: Integer

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

Instance Method Summary collapse

Instance Method Details

#denominatorObject



418
# File 'lib/rubysl/complex/complex.rb', line 418

def denominator() 1 end

#gcd(other) ⇒ Object



420
421
422
423
424
425
426
427
428
429
# File 'lib/rubysl/complex/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) ⇒ Object



431
432
433
434
435
436
437
# File 'lib/rubysl/complex/complex.rb', line 431

def lcm(other)
  if self.zero? or other.zero?
    0
  else
    (self.div(self.gcd(other)) * other).abs
  end
end

#numeratorObject



417
# File 'lib/rubysl/complex/complex.rb', line 417

def numerator() self end