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 digits for negative ZZRingElem consistent #1590

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

joschmitt
Copy link
Collaborator

@joschmitt joschmitt commented Nov 29, 2023

The digits function behaves inconsistent with julia integer types for negative numbers:

julia> digits(ZZ(-3))
1-element Vector{Int64}:
 7

julia> digits(-3)
1-element Vector{Int64}:
 -3

julia> digits(BigInt(-3))
1-element Vector{Int64}:
 -3

From the tests, I would assume that the result for ZZRingElem and BigInt should coincide; the tests are of course only for positive numbers though.
The issue is that Nemo.divrem is not the same as Base.divrem as I learnt from this comment here:

# N.B. Base.divrem differs from Nemo.divrem

Copy link

codecov bot commented Nov 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (659462d) 84.23% compared to head (a022a57) 84.21%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1590      +/-   ##
==========================================
- Coverage   84.23%   84.21%   -0.02%     
==========================================
  Files          94       94              
  Lines       36671    36671              
==========================================
- Hits        30888    30882       -6     
- Misses       5783     5789       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@thofma thofma merged commit 97ee5f6 into Nemocas:master Nov 30, 2023
14 of 15 checks passed
@joschmitt joschmitt deleted the digits branch November 30, 2023 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants