Skip to content

Commit

Permalink
feat: allow more types for jacobi_symbol (Nemocas#1855)
Browse files Browse the repository at this point in the history
  • Loading branch information
thofma authored Sep 19, 2024
1 parent 4d25cd4 commit 59d6a4f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Nemo"
uuid = "2edaba10-b0f1-5616-af89-8c11ac63239a"
version = "0.47.0"
version = "0.47.1"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
Expand Down
2 changes: 2 additions & 0 deletions src/flint/fmpz.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2044,6 +2044,8 @@ function jacobi_symbol(x::ZZRingElem, y::ZZRingElem)
(Ref{ZZRingElem}, Ref{ZZRingElem}), x, y))
end

jacobi_symbol(x::IntegerUnion, y::IntegerUnion) = jacobi_symbol(ZZ(x), ZZ(y))

@doc raw"""
jacobi_symbol(x::Int, y::Int)
Expand Down
8 changes: 7 additions & 1 deletion test/flint/fmpz-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1221,11 +1221,17 @@ end

@test jacobi_symbol(2, 3) == -1

for T in (Int, Integer, ZZRingElem)
for S in (Int, Integer, ZZRingElem)
@test jacobi_symbol(T(2), S(3)) == -1
end
end

@test_throws DomainError jacobi_symbol(2, 0)

@test_throws DomainError jacobi_symbol(-5, 4)

for T in [Int, ZZRingElem]
for T in (Int, ZZRingElem)
for iters = 1:1000
m1 = T(rand(-100:100))
n1 = T(rand(-100:100))
Expand Down

0 comments on commit 59d6a4f

Please sign in to comment.