Very simple printf

This is a discussion on Very simple printf within the C Programming forums, part of the General Programming Boards category; Code:
#include <stdio.h>
int main(void)
{
float x=123.23f;
printf("%f",x);
return 0;
}
This code gives me the result 123.230003
Why ...

EDIT:
Note that the "%f" with no precision specifiers gives you 6 digits after the decimal point, which for a float is enough to give you the bogus 3 out there. You could use a double to push the inaccuracy farther out right and have it not show up with the default "%lf" (you need the l in there for a double), but it's still not exact. Also, you can change printf to give less after the decimal point. For example, "%.3f" would give only 3 digits after the decimal.

Understanding floating point is one of the more interesting things, and most misunderstood. It could get very deep mathematically as well. But as for how floating point is represented internally, it's worthwhile looking into it.