summaryrefslogtreecommitdiff
path: root/ext/bigdecimal/lib/bigdecimal
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-11 10:45:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-11-11 10:45:21 +0000
commite644398bc6a06490e504f6ce18963431f18641ad (patch)
treeda73a0d8df8a85dca7db97ed2448c9d858b6b529 /ext/bigdecimal/lib/bigdecimal
parentd544a3d6c721b435151a74cb00aa32142a284097 (diff)
* 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
Diffstat (limited to 'ext/bigdecimal/lib/bigdecimal')
-rw-r--r--ext/bigdecimal/lib/bigdecimal/util.rb12
1 files changed, 0 insertions, 12 deletions
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