My question, in short is, why does rounding error in floats only show up after calculations and not for storage of literals?
What I mean is this - I know about the issues that arise due to rounding error in floats when converting from decimal to binary and back.
Eg, in Java:
double a = 10.567;
double b = 2.16;
double c = a * b;
c then stores the value 22.824720000000003, instead of 22.82472.
This is because the result 22.82472 cannot be stored accurately in the finite binary digits of the double type. However, neither can 10.567 and 2.16 (i.e. a and b).
But if I print the values of a and b, they are printed out exactly, without any rounding error. Why does rounding error not show up here?
Does this mean that the representation of float literals is somehow different from the representation of float calculation results?