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

fix mod for mixes of Signed and Unsigned #57853

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

oscardssmith
Copy link
Member

Previously this was just overfowing producing wrong answers (both for the sign convention and just the wrong modulo class)
fixes #57851

Previously this was just overfowing producing wrong answers (both for the sign convention and just the wrong modulo class)
fixes #57851
@oscardssmith oscardssmith added bugfix This change fixes an existing bug backport 1.10 Change should be backported to the 1.10 release backport 1.11 Change should be backported to release-1.11 backport 1.12 Change should be backported to release-1.12 maths Mathematical functions correctness bug ⚠ Bugs that are likely to lead to incorrect results in user code without throwing labels Mar 21, 2025
@StefanKarpinski
Copy link
Member

StefanKarpinski commented Mar 21, 2025

It should be noted that this changes the return type in these mixed cases, but that does seem like a bug fix. Given that the sign of the result comes from the second argument, it only seems sensible that the signedness also comes from the second argument. In fact, it would be find if the result type was simply the type of the second argument.

@oscardssmith
Copy link
Member Author

This doesn't change the result type.

@StefanKarpinski
Copy link
Member

Oh, nvm then.

@oscardssmith
Copy link
Member Author

(it actually did change the result type, but that was a bug)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 1.10 Change should be backported to the 1.10 release backport 1.11 Change should be backported to release-1.11 backport 1.12 Change should be backported to release-1.12 bugfix This change fixes an existing bug correctness bug ⚠ Bugs that are likely to lead to incorrect results in user code without throwing maths Mathematical functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The Base functions mod(::Unsigned, ::Signed) and mod(::Signed, ::Unsigned) are broken
2 participants