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

Why restricted to AbstractFloat? #13

Open
dlfivefifty opened this issue Oct 21, 2019 · 1 comment
Open

Why restricted to AbstractFloat? #13

dlfivefifty opened this issue Oct 21, 2019 · 1 comment
Assignees

Comments

@dlfivefifty
Copy link

This package doesn't work with interval arithmetic because it restricts to AbstractFloat:

julia> roots([1.,@interval(2),3])
ERROR: MethodError: no method matching roots!(::Array{Complex{Interval{Float64}},1}, ::Array{Complex{Interval{Float64}},1}, ::Float64, ::Int64, ::Bool)
Closest candidates are:
  roots!(::Array{Complex{T<:AbstractFloat},1}, ::Array{Complex{T<:AbstractFloat},1}, ::E<:AbstractFloat, ::Integer, ::Bool) where {T<:AbstractFloat, E<:AbstractFloat} at /Users/sheehanolver/.julia/packages/PolynomialRoots/gl0Ka/src/PolynomialRoots.jl:568
Stacktrace:
 [1] #roots#2(::Float64, ::Bool, ::typeof(roots), ::Array{Interval{Float64},1}) at /Users/sheehanolver/.julia/packages/PolynomialRoots/gl0Ka/src/PolynomialRoots.jl:613
 [2] roots(::Array{Interval{Float64},1}) at /Users/sheehanolver/.julia/packages/PolynomialRoots/gl0Ka/src/PolynomialRoots.jl:612
 [3] top-level scope at REPL[7]:1
@giordano
Copy link
Owner

About the why, it was done mostly for type-stability. I guess some signatures can be loosened while preserving type-stability. For context, this was one of my first Julia packages, I was overly conservative back then 🙂

@giordano giordano self-assigned this Oct 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants