-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
featureIndicates new feature / enhancement requestsIndicates new feature / enhancement requestsmathsMathematical functionsMathematical functions
Description
Base does not provide a function for checking divisibility:
"""
isdivisible(m, n)
Return true if `m` is divisible by `n`.
"""
isdivisible(m::Integer, n::Integer)It can be implemented as iszero(rem(m, n)) but that's not the optimal implementation for all types from Base (it allocates for a BigInt).
AbstractAlgebra.jl from Nemo implements this exact function: https://github.com/Nemocas/AbstractAlgebra.jl/blob/396fdddbc1d1620a7b2866e7340e39b14228176e/src/julia/Integer.jl#L121-L151
I would like to have it in Base.
(Discussed on Discourse: https://discourse.julialang.org/t/checking-divisibility-efficiently/121418)
Metadata
Metadata
Assignees
Labels
featureIndicates new feature / enhancement requestsIndicates new feature / enhancement requestsmathsMathematical functionsMathematical functions