diff options
| author | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-05-08 10:36:45 +0000 |
|---|---|---|
| committer | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-05-08 10:36:45 +0000 |
| commit | 6d27f7a15e806b77230dec64ef9b7e6ee1bb0009 (patch) | |
| tree | 9c498899e75d62ed68fee557a7445fc7d90d6f85 /lib/rational.rb | |
| parent | 3e3bd62e28b6fb54a97043b6b8562408d698cd70 (diff) | |
| download | ruby-6d27f7a15e806b77230dec64ef9b7e6ee1bb0009.tar.gz ruby-6d27f7a15e806b77230dec64ef9b7e6ee1bb0009.tar.xz ruby-6d27f7a15e806b77230dec64ef9b7e6ee1bb0009.zip | |
* lib/rational.rb: fix high-precision Rationals cannot be
converted to Floats. [ruby-Bugs:10502], [ruby-core:11069],
[ruby-dev:30743]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@12252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rational.rb')
| -rw-r--r-- | lib/rational.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/rational.rb b/lib/rational.rb index 5ed283cda..73e8cef8e 100644 --- a/lib/rational.rb +++ b/lib/rational.rb @@ -354,7 +354,7 @@ class Rational < Numeric # Converts the rational to a Float. # def to_f - @numerator.to_f/@denominator.to_f + @numerator.quof(@denominator) end # @@ -476,6 +476,7 @@ class Integer end class Fixnum + alias quof quo undef quo # If Rational is defined, returns a Rational number instead of a Fixnum. def quo(other) @@ -503,6 +504,7 @@ class Bignum alias power! ** end + alias quof quo undef quo # If Rational is defined, returns a Rational number instead of a Bignum. def quo(other) |
