Geeks With Blogs


View Anthony Trudeau's profile on LinkedIn

Add to Technorati Favorites

Anthony Trudeau

The EPCglobal tag data standards provides a calculation for the GTIN (global trade item number) check digit during SGTIN (serialized global trade item number) decoding.  However, this algorithm although mathematically correct does not work computationally due to different methods of handling modulus for negative numbers.

The tag data standards document defines the calculation for the GTIN check digit as:

d14 = (-3(d1 + d3 + d5 + d7 + d9 + d11 + d13) - (d2 + d4 + d6 + d8 + d10 + d12)) mod 10

The rest of the article can be read here:

Posted on Friday, November 11, 2005 4:18 PM .NET | Back to top

Comments on this post: Calculating a GTIN check digit

# re: Calculating a GTIN check digit
Requesting Gravatar...
You are correct! The C# mod operator is not consistent with the mathematical definition of modulus. Using it within the TDS prescribed algorithm will result in an incorrect check digit. I'm sending you an email describing how we dealt with this within iMotion 5.1.

Daniel Hernandez
Left by Daniel Hernandez on Nov 18, 2005 6:32 AM

# re: Calculating a GTIN check digit
Requesting Gravatar...
I'm looking forward to getting my early access copy.
Left by Anthony Trudeau on Nov 19, 2005 6:33 PM

Your comment:
 (will show your gravatar)

Copyright © Anthony Trudeau | Powered by: