From 754bee3869b6f64e963201b971fe5d3e82eea60a Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Wed, 30 May 2012 16:49:11 -0400 Subject: [PATCH] fix conversion of Rational to Rational --- base/rational.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/base/rational.jl b/base/rational.jl index 495492398915a..99f547a9cbbc6 100644 --- a/base/rational.jl +++ b/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}