I am working on an RPG and I use floating point variables for raw character stats. When they are displayed (or used in combat) they are truncated to integers. I use the floating point variables to an accuracy of 0.1.
I noticed that on a level up routine, if the number added to a particular stat (in this case, Agility), for instance, 1.2, would make the raw stat equal to a whole integer (e.x., 11.8 + 1.2 =13), the program would store it as 12.999999, and thus it would display improperly. On the next increase, the discrepancy would correct itself though......but the display would be wrong until then.
Any good way of getting around this?