Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make global variables const #1749

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/julia/Float.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#
###############################################################################

JuliaRealField = Floats{BigFloat}()
const JuliaRealField = Floats{BigFloat}()

RDF = Floats{Float64}()
const RDF = Floats{Float64}()

parent(a::T) where T <: AbstractFloat = Floats{T}()

Expand Down
16 changes: 8 additions & 8 deletions src/julia/Integer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ end
#
###############################################################################

sqrt_moduli = [3, 5, 7, 8]
sqrt_residues = [[0, 1], [0, 1, 4], [0, 1, 2, 4], [0, 1, 4]]
const sqrt_moduli = [3, 5, 7, 8]
const sqrt_residues = [[0, 1], [0, 1, 4], [0, 1, 2, 4], [0, 1, 4]]

@doc raw"""
sqrt(a::T; check::Bool=true) where T <: Integer
Expand Down Expand Up @@ -366,14 +366,14 @@ function root(a::T, n::Int; check::Bool=true) where T <: Integer
end
end

moduli3 = [7, 8, 13]
residues3 = [[0, 1, 6], [0, 1, 3, 5, 7], [0, 1, 5, 8, 12]]
const moduli3 = [7, 8, 13]
const residues3 = [[0, 1, 6], [0, 1, 3, 5, 7], [0, 1, 5, 8, 12]]

moduli5 = [8, 11, 31]
residues5 = [[0, 1, 3, 5, 7], [0, 1, 10], [0, 1, 5, 6, 25, 26, 30]]
const moduli5 = [8, 11, 31]
const residues5 = [[0, 1, 3, 5, 7], [0, 1, 10], [0, 1, 5, 6, 25, 26, 30]]

moduli7 = [8, 29, 43]
residues7 = [[0, 1, 3, 5, 7], [0, 1, 12, 17, 28], [0, 1, 6, 7, 36, 37, 42]]
const moduli7 = [8, 29, 43]
const residues7 = [[0, 1, 3, 5, 7], [0, 1, 12, 17, 28], [0, 1, 6, 7, 36, 37, 42]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was curious what these vectors are used for. Turns put the code is buggy: the code in line 391 below checks for divisibility by 3 instead of 7... oops.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also confused by the mix of % and mod. Can you provide a PR fixing this function or make an issue so we don't forget?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only have my phone right now


function ispower_moduli(a::Integer, n::Int)
if mod(n, 3) == 0
Expand Down
Loading