> 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/

Reply via email to