C or C++ don't care about what you need.
12.555 is not a binary floating point number. Binary floating point numbers are all integers multiplied by or divided by a power of two. 12.555 is not such a number. So when you write 12.555 then what you get is the floating-point number nearest to 12.555. Which may be smaller or larger than 12.555 and will be correctly rounded to 12.55 or correctly rounded to 12.56.
Calculate x * 1000 and round (x * 1000), which will give 12555. If x * 1000 is very close to round (x * 1000) and the last digit of round (x * 1000) is odd then increase it by 1. Divide by 10, round again, divide by 100.