summaryrefslogtreecommitdiff
path: root/lib/rational.rb
diff options
context:
space:
mode:
authortadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-27 11:48:00 +0000
committertadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-27 11:48:00 +0000
commitd4f5cb67d4284ba994ccda6b465ddd61883c5292 (patch)
treeb4d0ca47794b24472e65583d22ef6c2e9101e2fc /lib/rational.rb
parent69ad92d9cabbe83f3f6fe7ebb936b1d2c317f44b (diff)
* complex.c (f_lcm): removed.
* rational.c (rb_lcm, rb_gcdlcm): added. * lib/complex.rb (gcd, lcm, gcdlcm): removed. * lib/rational.rb (gcd, lcm, gcdlcm): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rational.rb')
-rw-r--r--lib/rational.rb32
1 files changed, 0 insertions, 32 deletions
diff --git a/lib/rational.rb b/lib/rational.rb
index b12bf7ef38..87c5d3f111 100644
--- a/lib/rational.rb
+++ b/lib/rational.rb
@@ -15,35 +15,3 @@ class Bignum
alias rpower **
end
-
-class Integer
-
- def gcd(other)
- min = self.abs
- max = other.abs
- while min > 0
- tmp = min
- min = max % min
- max = tmp
- end
- max
- end
-
- def lcm(other)
- if self.zero? or other.zero?
- 0
- else
- (self.div(self.gcd(other)) * other).abs
- end
- end
-
- def gcdlcm(other)
- gcd = self.gcd(other)
- if self.zero? or other.zero?
- [gcd, 0]
- else
- [gcd, (self.div(gcd) * other).abs]
- end
- end
-
-end