* lib/rational.rb: fix high-precision Rationals cannot be
converted to Floats. [ruby-Bugs:10502], [ruby-core:11069], [ruby-dev:30743] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12252 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
1548542f21
commit
721eb816c9
@ -1,3 +1,9 @@
|
|||||||
|
Tue May 8 19:32:18 2007 Keiju Ishitsuka <keiju@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/rational.rb: fix high-precision Rationals cannot be
|
||||||
|
converted to Floats. [ruby-Bugs:10502], [ruby-core:11069],
|
||||||
|
[ruby-dev:30743]
|
||||||
|
|
||||||
Mon May 7 10:59:55 2007 Kouhei Sutou <kou@cozmixng.org>
|
Mon May 7 10:59:55 2007 Kouhei Sutou <kou@cozmixng.org>
|
||||||
|
|
||||||
* lib/rss/image.rb, test/rss/test_image.rb: fixed Image module
|
* lib/rss/image.rb, test/rss/test_image.rb: fixed Image module
|
||||||
|
@ -354,7 +354,7 @@ class Rational < Numeric
|
|||||||
# Converts the rational to a Float.
|
# Converts the rational to a Float.
|
||||||
#
|
#
|
||||||
def to_f
|
def to_f
|
||||||
@numerator.to_f/@denominator.to_f
|
@numerator.quof(@denominator)
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -476,6 +476,7 @@ class Integer
|
|||||||
end
|
end
|
||||||
|
|
||||||
class Fixnum
|
class Fixnum
|
||||||
|
alias quof quo
|
||||||
undef quo
|
undef quo
|
||||||
# If Rational is defined, returns a Rational number instead of a Fixnum.
|
# If Rational is defined, returns a Rational number instead of a Fixnum.
|
||||||
def quo(other)
|
def quo(other)
|
||||||
@ -503,6 +504,7 @@ class Bignum
|
|||||||
alias power! **
|
alias power! **
|
||||||
end
|
end
|
||||||
|
|
||||||
|
alias quof quo
|
||||||
undef quo
|
undef quo
|
||||||
# If Rational is defined, returns a Rational number instead of a Bignum.
|
# If Rational is defined, returns a Rational number instead of a Bignum.
|
||||||
def quo(other)
|
def quo(other)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user