Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/complex.rb
Instance Method Summary collapse
Instance Method Details
#denominator ⇒ Object
422 |
# File 'lib/complex.rb', line 422 def denominator() 1 end |
#gcd(other) ⇒ Object
424 425 426 427 428 429 430 431 432 433 |
# File 'lib/complex.rb', line 424 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
435 436 437 438 439 440 441 |
# File 'lib/complex.rb', line 435 def lcm(other) if self.zero? or other.zero? 0 else (self.div(self.gcd(other)) * other).abs end end |
#numerator ⇒ Object
421 |
# File 'lib/complex.rb', line 421 def numerator() self end |