Because the local 'index' variable shadows the index() function it was replaced by 'i'. Unfortunately when I made this change I accidentally replaced one instance with 'j' resulting in the short decimal values being printed incorrectly.