Almost ALL of the "automatic" conversions between floats and integer types in C are simple truncation, so converting 3.13999999 * 100 to an int will give you 3.13 (for example.) To get the values you expect, you probably have to do a significant amount of (+ 0.5) in order to get rounding instead.