A slight additional comment to Mike's above, which I think is correct, is my feeling that this `abs(dcdf[i]) < 10*tol check is implicitly relying on some broad normalization of the probability values which hasn't been assumed hitherto, and isn't required in the documentation.  In fact, I can see below that you quietly normalize later on.  You could imagine, for example, that were all the input probabilities tiny for some reason due to a wacky normalization it looks like this test might end up deleting significant jumps in normalized prob. space.