Skip to content

round(Int,1+0im) throws an error while convert does not (Int,1+0im) in 0.4.1 #14261

@dlfivefifty

Description

@dlfivefifty

The following seems inconsistent:

julia> convert(Int,-1+0im)
-1

julia> round(Int,-1+0im)
ERROR: MethodError: `round` has no method matching round(::Type{Int64}, ::Complex{Int64})
Closest candidates are:
  round{T<:Integer}(::Type{T<:Integer}, ::Integer)
  round{T<:Integer}(::Type{T<:Integer}, ::Float16)
  round{T<:Union{Signed,Unsigned}}(::Type{T<:Union{Signed,Unsigned}}, ::BigFloat)
  ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexComplex numbers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions