JuliaMath / Primes.jl

Prime numbers in Julia
Other
99 stars 32 forks source link

suppressed Integer annotation on Factorization; fixed bug in calls of… #127

Closed jmichel7 closed 1 year ago

jmichel7 commented 1 year ago

I suppressed the annotations <:Integer on the T of Factorization, allowing Primes.Factorization to be used to hold factorizations of other than integer (my goal is for polynomials). I added tests in runtest.jl where T is Symbol. Along the way, I fixed bugs in the calls to searchsortedfirst. In the call searchsortedfirst(f.pe, p, by=first) contrary to intuition, the function by is applied to p so the proper second argument should be a pair. This does not show for p integer since then first(p)==p but it shows for other types. The fix is to give a pair: searchsortedfirst(f.pe, p=>0, by=first)

oscardssmith commented 1 year ago

Sorry for forgetting about this. Merging once CI passes.