Skip to content

Commit

Permalink
Merge pull request #34 from tlycken/master
Browse files Browse the repository at this point in the history
Support rounding of rationals
  • Loading branch information
timholy committed Dec 27, 2014
2 parents 73c4a03 + fbbd8f7 commit dd7567d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ if VERSION < v"0.4.0-dev+1827"
@eval begin
($fnew){T<:Integer}(::Type{T}, x::Integer) = convert(T, x) # ambiguity resolution with digits/base version, not all old methods defined
($fnew){T<:Integer}(::Type{T}, x) = ($fold)(T, x)
($fnew){T<:Integer}(::Type{T}, x::Rational) = convert(T, ($fold)(x)) # no e.g. iround(::Type{T}, x::Rational) is defined in 0.3
end
end
end
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,5 @@ ns = length(d.slots)
if VERSION < v"0.4.0-dev+1387"
@test isdefined(Main, :AbstractString)
end

@test round(Int, 3//4) == 1

0 comments on commit dd7567d

Please sign in to comment.