Board index » cppbuilder » FloatToStr
Colin Hughes
![]() CBuilder Developer |
FloatToStr2005-02-19 08:05:03 PM cppbuilder76 I am using Borland C++Builder 5 This is a new problem only seen on my latest computers and upgrades. I can only look at what is different. Old computers use Celeron and new ones use P4. (we are also having problems with another program on computers upgraded from Celeron to P3) 'well that all the motherboards would take'. Different Microsoft updates code sample. String value = InputBox("Input Box", "Enter Value for Pilot Delay ", FloatToStr(WBSetup->ManuaPilotSeparationDefault)); try { WBSetup->ManuaPilotSeparationDefault = StrToFloat(value); } catch(const EConvertError &e) { ShowMessage("Not A valid floating point number Try Again"); } NOTE WBSetup values are stored in registry on shutdown. The problem seems to be with FloatToStr(); A value of 18 should return just "18". After computer is running for a while it will return 18.00000000061189. Seems that the value is being down casted to float so the last values are not defined. A value of 1 returnes 0.9999999998430675 A value of 2 returnes 1.999999999686135. I have changed the code to use FloatToStringF() but have not tested in on production conmputers. If I exit program and restart the problem is still threre. Computer reboot clears problem. Any help would be usefull Thanks Colin |