diff --git a/src/LocalField/Poly.jl b/src/LocalField/Poly.jl index 7debf9ede5..43ec8f08df 100644 --- a/src/LocalField/Poly.jl +++ b/src/LocalField/Poly.jl @@ -835,7 +835,7 @@ function Hensel_factorization(f::Generic.Poly{T}) where T <: Union{padic, qadic, H = HenselCtxdr{T}(f, vlfp) lift(H, precision(f)) for i = 1:H.n - D[ks[i]] = H.lf[i] + D[ks[i]] = setprecision(H.lf[i], precision(f)) end return D end diff --git a/src/LocalField/automorphisms.jl b/src/LocalField/automorphisms.jl index 37149b3c62..4abd2dbe6f 100644 --- a/src/LocalField/automorphisms.jl +++ b/src/LocalField/automorphisms.jl @@ -101,7 +101,7 @@ function _roots(f::Generic.Poly{T}) where T <: Union{padic, qadic, LocalFieldEle g = f(pi*x+r) g = divexact(g, _content(g)) rtg = roots(g) - rts = elem_type(K)[setprecision(r, precision(y)) + pi*y for y in rtg] + rts = elem_type(K)[setprecision(r, precision(y)+1) + pi*y for y in rtg] return rts end diff --git a/test/LocalField/Poly.jl b/test/LocalField/Poly.jl index 0b2cae8b3e..ef0495eae3 100644 --- a/test/LocalField/Poly.jl +++ b/test/LocalField/Poly.jl @@ -79,6 +79,15 @@ @test length(Hecke.slope_factorization(2*x+1)) == 1 end + @testset "Roots" begin + _, t = PadicField(3, 10)["t"] + f = ((t-1+81)*(t-1+2*81)) + rt = roots(f) + @test length(rt) == 2 + @test rt[1] != rt[2] + @test all(iszero, map(f, rt)) + end + @testset "Resultant" begin R, x = polynomial_ring(PadicField(853, 2), "x") a = 4*x^5 + x^4 + 256*x^3 + 192*x^2 + 48*x + 4