Skip to content

Commit

Permalink
Add more divrem functions
Browse files Browse the repository at this point in the history
  • Loading branch information
paemurru committed Nov 29, 2024
1 parent 7d32c4b commit 7c7b930
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/flint/fmpz.jl
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,10 @@ divrem(x::ZZRingElem, y::Integer) = divrem(x, ZZRingElem(y))

divrem(x::Integer, y::ZZRingElem) = divrem(ZZRingElem(x), y)

Base.divrem(x::ZZRingElem, y::Integer) = Base.divrem(x, ZZ(y))
# Without the functions below, Julia defaults to `(div(x, y), rem(x, y))`
Base.divrem(x::ZZRingElem, y::Integer) = (
Base.divrem(x, ZZ(y))
)
Base.divrem(x::ZZRingElem, y::Integer, ::typeof(RoundToZero)) = (

Check warning on line 668 in src/flint/fmpz.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz.jl#L668

Added line #L668 was not covered by tests
Base.divrem(x, ZZ(y), RoundToZero)
)
Expand All @@ -671,6 +674,18 @@ Base.divrem(x::ZZRingElem, y::Integer, ::typeof(RoundUp)) = (
Base.divrem(x::ZZRingElem, y::Integer, ::typeof(RoundDown)) = (

Check warning on line 674 in src/flint/fmpz.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz.jl#L674

Added line #L674 was not covered by tests
Base.divrem(x, ZZ(y), RoundDown)
)
Base.divrem(x::Integer, y::ZZRingElem) = (
Base.divrem(ZZ(x), y)
)
Base.divrem(x::Integer, y::ZZRingElem, ::typeof(RoundToZero)) = (

Check warning on line 680 in src/flint/fmpz.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz.jl#L680

Added line #L680 was not covered by tests
Base.divrem(ZZ(x), y, RoundToZero)
)
Base.divrem(x::Integer, y::ZZRingElem, ::typeof(RoundUp)) = (

Check warning on line 683 in src/flint/fmpz.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz.jl#L683

Added line #L683 was not covered by tests
Base.divrem(ZZ(x), y, RoundUp)
)
Base.divrem(x::Integer, y::ZZRingElem, ::typeof(RoundDown)) = (

Check warning on line 686 in src/flint/fmpz.jl

View check run for this annotation

Codecov / codecov/patch

src/flint/fmpz.jl#L686

Added line #L686 was not covered by tests
Base.divrem(ZZ(x), y, RoundDown)
)

###############################################################################
#
Expand Down

0 comments on commit 7c7b930

Please sign in to comment.