Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix conversion of Rational to Rational

  • Loading branch information...
commit 754bee3869b6f64e963201b971fe5d3e82eea60a 1 parent b1acc18
@JeffBezanson JeffBezanson authored
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}
Please sign in to comment.
Something went wrong with that request. Please try again.