public static int RoundToInt(float f, MidpointRounding mode = MidpointRounding.AwayFromZero) { return (int) Math.Round(f, mode); }