floating point numbers can not represent all number exactly so you might have small rounding errors. .09*100.00 might be slightly less than 9. When you convert the number to an int you just throw away the fractional part. You could try to round the number before casting. cents = static_cast<int>(round(fractPart * 100.00));