Considering the rather well known precision problems with floats, what is the best approach to at least reduce the impact, for instance in such a situation:
float fData = StringToFloat(Get2DAString());
I'm currently using this for a custom IP system(calculating cost), and the retrieved values are float, for the most part, unfortunately. So, if the 2DA value is 0.9, I display its value right after assignment, and I get 0.8999999 with maybe a few more or less 9, 50 being the last two numbers of the decimal part. No big deal with small numbers but for big ones, ouch...
Would there be a way around this problem?
Thanks!
Kato
Modifié par Kato_Yang, 15 juillet 2012 - 08:54 .





Retour en haut






