The two strings are clearly different, so strcmp()
is working as it should.
The issue is that 1231.23123
cannot be represented as a float
. In fact, the nearest number that can be represented as a float
is 1231.231201171875
, which is what you're seeing (rounded by sprintf()
to six decimal places).