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

check digit calculation #3

Open
rtphokie opened this issue Nov 28, 2020 · 0 comments
Open

check digit calculation #3

rtphokie opened this issue Nov 28, 2020 · 0 comments

Comments

@rtphokie
Copy link

Perhaps it's my unfamiliarity with Go, but I'm seeing two small errors in how the check digit is calculated.

Comparing the code in ups.go to the algorithm described here, it appears that line 55 should subtract 48 instead of 3 from the ascii value of the character.

Line 63 should also be enclosed in an else. As it stands the running sum of calculations for characters in the odd position also includes characters in the even position as well.

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

No branches or pull requests

1 participant