You can round in C by multiplying for the significance, adding +0.5, round down (equals as casting to an integer) and divide. float f_rounded = ((int) (f * 10.0 + 0.5) / 10.0); 28.6 will be: float f_rounded = ((int) (28.6 * 10.0 + 0.5) / 10.0) = ((int) 286.5) / 10.0 = 286 / 10.0 = 28.6 In Python it is equal (except the cast operator is int(...)