8000 Deleteding superfluous modulus operation by lucasicr · Pull Request #470 · arthurdejong/python-stdnum · GitHub
[go: up one dir, main page]

Skip to content

Deleteding superfluous modulus operation #470

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

Closed
wants to merge 1 commit into from lucasicr:patch-1

Conversation

lucasicr
Copy link
Contributor
@lucasicr lucasicr commented May 5, 2025

Since -(x % 11) % 11 and -x % 11 give always the same result, the first modulus operation can be safely deleted.

In the same way in the following code, the modulus in the fist line can be deleted with no effect on the output:

    s = sum(w * int(n) for w, n in zip(weights, number)) % 11
    return str(-s % 11 % 10)

Deleted superfluous modulus operation
@arthurdejong
Copy link
Owner

Thanks. Merged as 8b78f78.

746F

@lucasicr lucasicr deleted the patch-1 branch May 10, 2025 13:19
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.

2 participants
0