Open martinkjlarsson opened 3 months ago
I was just passing by (incidentally looking at existing gcd issues), I think the problem here might be integer overflow https://github.com/JuliaAlgebra/DynamicPolynomials.jl/issues/107.
Changing the lines in your file
p1 = sum(c1 .* vec(prod(v1 .^ e1, dims=1)))
p2 = sum(c2 .* vec(prod(v2 .^ e2, dims=1)))
to
p1 = sum(BigInt.(c1) .* vec(prod(v1 .^ e1, dims=1)))
p2 = sum(BigInt.(c2) .* vec(prod(v2 .^ e2, dims=1)))
seems to work for me.
Ahh, makes sense I suppose. Thanks!
Yes, we don't automatically promote to BigInt
, we might want to use checked operations
I work with some massive polynomials (close to 4000 terms) and when calling
gcd
I get the following errorThe stack trace continues for quite a while. This does not happen with TypedPolynomials.jl, so it may be a bug with DynamicPolynomials.jl. Maybe this is a bit unusual use case, but I figured I'd submit an issue.
A minimal working example is attached as a text file as the polynomials are huge. error.txt
Version info: DynamicPolynomials v0.5.5 TypedPolynomials v0.4.1 Julia Version 1.10.2