diff options
| author | shigek <shigek@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-06-27 04:40:25 +0000 |
|---|---|---|
| committer | shigek <shigek@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-06-27 04:40:25 +0000 |
| commit | 807ad614530d6e3c1470ad7abb3d05a71516d862 (patch) | |
| tree | f282b0694f4db30179eee573ee3844f5678d4aee /ext/bigdecimal/lib | |
| parent | 2546e398139e81fee5cabea35045ed9f081d8fc4 (diff) | |
| download | ruby-807ad614530d6e3c1470ad7abb3d05a71516d862.tar.gz ruby-807ad614530d6e3c1470ad7abb3d05a71516d862.tar.xz ruby-807ad614530d6e3c1470ad7abb3d05a71516d862.zip | |
Changed according to Tadashi Saito's advice.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/bigdecimal/lib')
| -rw-r--r-- | ext/bigdecimal/lib/bigdecimal-rational.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/bigdecimal/lib/bigdecimal-rational.rb b/ext/bigdecimal/lib/bigdecimal-rational.rb index de999d19c..041e8c701 100644 --- a/ext/bigdecimal/lib/bigdecimal-rational.rb +++ b/ext/bigdecimal/lib/bigdecimal-rational.rb @@ -1,10 +1,10 @@ # # BigDecimal <-> Rational # -class BigDecimal +class BigDecimal < Numeric # Convert BigDecimal to Rational def to_r - sign,digits,base,power = self.to_parts + sign,digits,base,power = self.split numerator = sign*digits.to_i denomi_power = power - digits.size # base is always 10 if denomi_power < 0 @@ -12,11 +12,11 @@ class BigDecimal else denominator = base ** denomi_power end - Rational.new(numerator,denominator) + Rational(numerator,denominator) end end -class Rational +class Rational < Numeric # Convert Rational to BigDecimal # to_d returns an array [quotient,residue] def to_d(nFig=0) |
