I'm struggling to understand what sort of rounding needs to be implemented to produce the grade in [pset6 readability].
For the Harry Potter extract provided ("Harry Potter was a highly unusual boy ..."), the Coleman-Liau formula in my program returns (before rounding) 4.555714285714288. CS50's expected output from this is Grade 5 (rounding up). My code accordingly prints Grade 5.
For the Fitzgerald extract ("In my younger and more vulnerable years ..."), my program's formula produces 7.4556521739130375. CS50's expected output from this is Grade 7 (rounding down). My code prints Grade 8.
I can see how both floats could be rounded up or down depending on what sort of rounding gets applied, but I can't think of what could be done programmatically to replicate what CS50 seems to require, as the rounding seems to go in two opposing directions in similar circumstances in different examples.
I'd conclude that there is a bug further back in my code that is leading to incorrect numbers being fed into the formula, but my program passes most of the check50 tests, so this seems unlikely.
What sort of rounding technique ought I to be applying here?
(edit to remove working code per academic honesty guidelines)