I was having some issues with this code. It was working in debug mode but would erroneously output 0.0 for some of the csv lines in release mode. It was only when I added