Skip to content

Commit

Permalink
fix conversion of Rational to Rational
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed May 30, 2012
1 parent b1acc18 commit 754bee3
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions base/rational.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function convert{T<:Integer}(::Type{Rational{T}}, x::Float, tol::Real)
end
convert{T<:Integer}(rt::Type{Rational{T}}, x::Float) = convert(rt,x,0)
convert(::Type{Bool}, x::Rational) = (x!=0) # to resolve ambiguity
convert{T<:Rational}(::Type{T}, x::Rational) = x
convert{T<:Real}(::Type{T}, x::Rational) = convert(T, x.num/x.den)

promote_rule{T<:Integer}(::Type{Rational{T}}, ::Type{T}) = Rational{T}
Expand Down

0 comments on commit 754bee3

Please sign in to comment.