Better fix for floating point error in calculating agent numbers