Hi all can any one tell me why when I convert std::string to float or double type the decimal part of value is not exactly as in the string ?
for example float value 1.56 loaded from file and converted to float is 1.55999994
can you explain why this is happening and how I can fix this ?
Here is a page that will show you what various decimal numbers will be represented as using the standard IEEE floating point representation. Note that 1.56 comes out as 1.559999942779541 - which is what you found when you tried it.