Not so. "A little knowledge is a dangerous thing."
Of course, Knuth is quite right that you are in a state of sin if you try to compare two floats for equality, but that's not what's happening here - these are order comparisons, and there isn't going to be any better calculation giving a more accurate computation.
No matter how you perform this calculation, there will be the possibility of numbers very close to one end of these intervals ending in the next interval, but there's nothing wrong with that — this is in the nature of histograms.
Believe I'm wrong? Then show me some computation that gives a better result, given a float input.
It’s the API that is wrong — the incoming value should probably be a pair of integers, “total” and “correct”.