Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion to complex should throw an error #47

Open
dlfivefifty opened this issue Oct 31, 2018 · 1 comment
Open

Conversion to complex should throw an error #47

dlfivefifty opened this issue Oct 31, 2018 · 1 comment

Comments

@dlfivefifty
Copy link
Member

The following behaviour is problematic:

julia> d = convert(AbstractInterval{ComplexF64}, 0..1)
0.0 + 0.0im..1.0 + 0.0im

julia> 0.5 in d
ERROR: MethodError: no method matching isless(::Complex{Float64}, ::Float64)
Closest candidates are:
  isless(::Float64, ::Float64) at float.jl:459
  isless(::Missing, ::Any) at missing.jl:66
  isless(::AbstractFloat, ::AbstractFloat) at operators.jl:148
  ...
Stacktrace:
 [1] <(::Complex{Float64}, ::Float64) at ./operators.jl:260
 [2] <=(::Complex{Float64}, ::Float64) at ./operators.jl:309
 [3] in(::Float64, ::Interval{:closed,:closed,Complex{Float64}}) at /Users/sheehanolver/.julia/packages/IntervalSets/xr34V/src/IntervalSets.jl:126
 [4] top-level scope at none:0
@hyrodium
Copy link
Collaborator

hyrodium commented Apr 3, 2022

Should we drop the following constructor, not just the conversion?

julia> d = (1)..(1+im)
1 + 0im..1 + 1im

julia> 1 in d
ERROR: MethodError: no method matching isless(::Complex{Int64}, ::Int64)
Closest candidates are:
  isless(::AbstractFloat, ::Real) at ~/julia/julia-1.7.2/share/julia/base/operators.jl:186
  isless(::Real, ::Real) at ~/julia/julia-1.7.2/share/julia/base/operators.jl:430
  isless(::Any, ::Missing) at ~/julia/julia-1.7.2/share/julia/base/missing.jl:88
  ...
Stacktrace:
 [1] <(x::Complex{Int64}, y::Int64)
   @ Base ./operators.jl:352
 [2] <=(x::Complex{Int64}, y::Int64)
   @ Base ./operators.jl:401
 [3] in(v::Int64, I::ClosedInterval{Complex{Int64}})
   @ IntervalSets ~/.julia/dev/IntervalSets/src/IntervalSets.jl:120
 [4] top-level scope
   @ REPL[4]:1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants