From e644398bc6a06490e504f6ce18963431f18641ad Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 11 Nov 2008 10:45:21 +0000 Subject: * ext/bigdecimal/bigdecimal.c (BigDecimal_to_r): moved from bigdecimal/util, converted into C. [ruby-dev:36805] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20191 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/bigdecimal/lib/bigdecimal/util.rb | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'ext/bigdecimal/lib/bigdecimal/util.rb') diff --git a/ext/bigdecimal/lib/bigdecimal/util.rb b/ext/bigdecimal/lib/bigdecimal/util.rb index 09e926acd5..257781f035 100644 --- a/ext/bigdecimal/lib/bigdecimal/util.rb +++ b/ext/bigdecimal/lib/bigdecimal/util.rb @@ -39,18 +39,6 @@ class BigDecimal < Numeric i + "." + ("0"*(-z)) + f end end - - # Converts a BigDecimal to a Rational. - def to_r - sign,digits,base,power = self.split - numerator = sign*digits.to_i - denomi_power = power - digits.size # base is always 10 - if denomi_power < 0 - Rational(numerator,base ** (-denomi_power)) - else - Rational(numerator * (base ** denomi_power),1) - end - end end class Rational < Numeric -- cgit v1.2.3