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

The iterator eachfactor is not type-stable #151

Closed
byhill opened this issue Feb 21, 2024 · 2 comments · Fixed by #152
Closed

The iterator eachfactor is not type-stable #151

byhill opened this issue Feb 21, 2024 · 2 comments · Fixed by #152

Comments

@byhill
Copy link

byhill commented Feb 21, 2024

Consider the following code.

julia> eltype(eachfactor(Int32(901800900)))
Tuple{Int32, Int64}

julia> for (p, e) in eachfactor(Int32(901800900))
       println()
       println((p, typeof(p)))
       println((e, typeof(e)))
       end

(2, Int32)
(2, Int64)

(3, Int64)
(2, Int64)

(5, Int64)
(2, Int64)

(7, Int64)
(2, Int64)

(11, Int32)
(2, Int64)

(13, Int32)
(2, Int64)

The eachfactor iterator should return (at least based on it's eltype) Tuple{Int32,Int64} but it returns a mixture of Tuple{Int32,Int64} and Tuple{Int64,Int64}.

@byhill byhill changed the title The iterator eachfactor doesn't match it's eltype. The iterator eachfactor doesn't respect it's eltype. Feb 21, 2024
@byhill byhill changed the title The iterator eachfactor doesn't respect it's eltype. The iterator eachfactor is not type-stable Feb 21, 2024
@oscardssmith
Copy link
Member

ah good catch. This was mostly tested on Int64 inputs. Fixing this should be pretty easy.

oscardssmith added a commit that referenced this issue Feb 21, 2024
fixes #151. (test incoming)
oscardssmith added a commit that referenced this issue Feb 21, 2024
* fix `eachfactor` type stability

fixes #151. (test incoming)

* add test
@oscardssmith
Copy link
Member

fixed and version tagged (Pkg should know about it in ~1 hr)

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

Successfully merging a pull request may close this issue.

2 participants