Search the archives for GetStringFromDouble. Email me directly if you need help.
Alan Ingleby "Andreas Zankl" <[EMAIL PROTECTED]> wrote in message news:94876@palm-dev-forum... > > Unfortunately my calculation is more complicated than that. It uses a whole > lot of MathLib functions.Does anybody know a better function than > FloatToString? > Andreas. > > P.S.: By mistake I sent my original posting again, sorry for that. > > > > Aaron Ardiri schrieb: > > > > After searching the archives I found the following routine from Bradly > > > Barton to convert float variables to string. Unfortunately it is not > > > working correctly: 6.964559 is converted to 6.10 (for round = 1). That' > > > s obviously wrong and there is also one digit more than there should be > > > (for round =1). It works correctly with values not so close to the next > > > full integer (7 in this example, 6.55555 works OK) Can anybody fix > > > this? Is Bradly Barton still out there? > > > > how about not using floats? :) > > > > john posted a nice google hint for you - take a read of this. the > > best way to ensure that a float is printed correctly is to not > > use floating point. try using another mechanism to represent your > > data. > > > > for example, monetary values can be stored x100. you print it > > as X.XX by dividing by 100, adding a '.' and, printing the > > modulus of 100 (with a leading zero if needed) to generate the > > string for display on the screen. > > > > --- > > Aaron Ardiri > > CEO - CTO > > Mobile Wizardry > > http://www.mobilewizardry.com/ > > > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
