posts - 94, comments - 121, trackbacks - 82

My Links

News

View Anthony Trudeau's profile on LinkedIn

Add to Technorati Favorites

Article Categories

Archives

Post Categories

Image Galleries

Other Links

Calculating a GTIN check digit

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:  http://geekswithblogs.net/tonyt/articles/70281.aspx

Print | posted on Friday, November 11, 2005 4:18 PM | Filed Under [ .NET ]

Feedback

Gravatar

# re: Calculating a GTIN check digit

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
11/18/2005 6:32 AM | Daniel Hernandez
Gravatar

# re: Calculating a GTIN check digit

I'm looking forward to getting my early access copy.
11/19/2005 6:33 PM | Anthony Trudeau
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification:
 

Powered by: