Fix rounding errors when looking for ties