From da4e5dc039dbdc0ad53f76ac5f42e6427af7ce46 Mon Sep 17 00:00:00 2001 From: Tim Holy Date: Thu, 27 Nov 2014 05:06:01 -0600 Subject: [PATCH] Compatibility for trunc(T, x) etc (Julia PR #9133) --- src/Compat.jl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Compat.jl b/src/Compat.jl index 3246997427576..0012c3980a4e0 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -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