Here's a link to a paper talking about software that does this. The algorithm is in one of the tables.
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2901033/#!po=43.9394
Here is the software version of the algorithm.
http://www.esolutions.smart-bits.pl/eservices/products/diabetics/diabetics_en.htm
http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2901033/#!po=43.9394
Here is the software version of the algorithm.
http://www.esolutions.smart-bits.pl/eservices/products/diabetics/diabetics_en.htm