Skip to content

Commit

Permalink
Fix wrong results in adhoc arithmetic for Zmodn_poly and UInt
Browse files Browse the repository at this point in the history
Caught by new conformance tests for adhoc arithmetic
  • Loading branch information
fingolfin committed Nov 8, 2024
1 parent b439e0b commit 24fb717
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/flint/nmod_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ end

function *(x::T, y::UInt) where T <: Zmodn_poly
z = parent(x)()
@ccall libflint.nmod_poly_scalar_mul_nmod(z::Ref{T}, x::Ref{T}, y::UInt)::Nothing
return z
return mul!(z, x, y % modulus(x))
end

*(x::UInt, y::T) where T <: Zmodn_poly = y*x
Expand Down Expand Up @@ -202,6 +201,7 @@ end

function +(x::T, y::UInt) where T <: Zmodn_poly
z = parent(x)()
y %= modulus(x)
@ccall libflint.nmod_poly_add_ui(z::Ref{T}, x::Ref{T}, y::UInt)::Nothing
return z
end
Expand Down Expand Up @@ -232,6 +232,7 @@ end

function -(x::T, y::UInt) where T <: Zmodn_poly
z = parent(x)()
y %= modulus(x)
@ccall libflint.nmod_poly_sub_ui(z::Ref{T}, x::Ref{T}, y::UInt)::Nothing
return z
end
Expand Down

0 comments on commit 24fb717

Please sign in to comment.