fixed floating errors in calculate for CharacterFreq