Some Duplicates:
1.265 * 10000 = 126499.99999999999 ?????
How is floating point stored? When does it matter?
Strange floating-point behaviour in a Java program
Why do I see a double variable initialized to some value like 21.4 as 21.399999618530273?
Error in Flash addition
I divide 23 by 40 (23/40). In C this operation results in 0.5749999999999996. But actually it must be 0.575!
How can I fix this?
Take a look at this - it should tell you everything you need to know about Why Computers Suck At Math
It is normal with floating point arithmetic. You can change the way how your floats and doubles are printed using %.3g for example
You can't fix this. Not all numbers can be represented as floats, see "how is floating point stored, when does it matter".
That is an artifact from how floating point numbers are stored.
Either you could round the answer sprintf("%.3f", result) or use some Decimal handling package.
The problem is because the .575 value doesn't have an exact representation in floating point encoding. The fix depends on what you have to do with the value as well as the impact of the inaccuracy.
If it is just a display problem use rounding to 3 decimals and you'll get the 0.575.
If it is because of computation inaccuracy, try keeping the value as a fraction which will be exact. You'll have to store and handle two floating point values but it will be exact. Postpone the effective division to the last moment when you need the result.
Check if the difference between the two value is relevant for your problem. For instance subtract sqrt epsilon to the value and check how much the change influences the final computation result and compare it with the required or desired precision.
Unfortunately we have to live with the limitation of real value representation in float. Using 128 bit precision floats will make the error much smaller but not null.
I suggest you do a search on the web for "floating point accuracy" or look at the absolute dozens of other questions on SO that yours is a duplicate of.