Browse files

fix conversion of Rational to Rational

  • Loading branch information...
1 parent b1acc18 commit 754bee3869b6f64e963201b971fe5d3e82eea60a @JeffBezanson JeffBezanson committed May 30, 2012
Showing with 1 addition and 0 deletions.
  1. +1 −0 base/rational.jl
View
1 base/rational.jl
@@ -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}

0 comments on commit 754bee3

Please sign in to comment.