Skip to content

Commit

Permalink
Compatibility for trunc(T, x) etc (Julia PR #9133)
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Nov 27, 2014
1 parent 8211e38 commit da4e5dc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@ else
end
end

import Base: round, ceil, floor, trunc
if VERSION < v"0.4.0-dev+1827"
for (fnew,fold) in ((:round, :iround), (:ceil, :iceil), (:floor, :ifloor), (:trunc, :itrunc))
@eval begin
($fnew){T<:Integer}(::Type{T}, x::Integer) = ($fold)(T, x) # ambiguity resolution with digits/base version
($fnew){T<:Integer}(::Type{T}, x) = ($fold)(T, x)
end
end
end

function rewrite_dict(ex)
length(ex.args) == 1 && return ex

Expand Down

0 comments on commit da4e5dc

Please sign in to comment.