Skip to content

Commit

Permalink
Merge pull request #20 from JuliaLang/teh/itrunc
Browse files Browse the repository at this point in the history
Compatibility for trunc(T, x) etc (Julia PR #9133)
  • Loading branch information
timholy committed Nov 30, 2014
2 parents 8211e38 + da4e5dc commit 717dd90
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 717dd90

Please sign in to comment.