For the large sentence test of pset2's Readability task, I was constantly getting Grade 8 instead of Grade 7, even after checking the counting went properly. After roughly an hour of debugging I've narrowed the issue down to this line:
float l = (100 * lettercount) / wordcount, s = (100 * sentencecount) / wordcount;
The issue seems to be that L and S end up being integers (in this case 417.0000 and 4.0000), whereas the values they should have are 417.391304348 and 7.45565217391 respectively. I can't figure out why this is happening. It seems as if it's being truncated but I have no idea where. Can anyone help?