It is impossible for memory to store decimal floats exactly because computers have to use binary in 32 bytes to represent untold digits. Using double gives it more memory to be more precise, but it will still never be exact. After 7 or so, the numbers will be meaningless. If you need more precise significant digits, use setprecision(#).
Both Double and float data type are used torepresent floating point numbers , adouble data type is more precise than float. Adouble variable can provide precision up to 15to 16 decimal points as compared to floatprecision of 6 to 7 decimal digits
First of all im so sorry that u got offended i did not mean anything bad by that
And about the question i totally understood what u just explained but why does it print the exact amount of 56.23 then? Try it and u will see. The fraction part isnt a power of 2
And in the last im sorry again about earlier but if u thaught or did even a bit diffrently because of my country i cant forgive that with respect
Thanks for your answers Miika , they are very instructive.
I would like to go a step further and ask wether this "rounding problem" is language and/or compiler specific. i.e. does it happen in every C compiler? and does it happen in all of the languages? or only insome of the languages?