> I have my own conversion routines to get decimal strings to floating point
> numbers and they seem to work.  However when I add the resulting floating
> point numbers I get errors.  I looked at a few additions in the debugger and
> it's definitely doing it wrong.  For example when I add 52333.08 to 23821.71
> I get 76154.80 instead of 76154.79.  It gets an answer that's a penny high
> in the cases I've seen and it's fairly frequent.  I have a little report
> with about 15 subtotals on it and two of them are a penny high.

welcome to the world of floating point.

http://research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html

very good explanation here:

http://www.keil.com/support/docs/2414.htm

if you are going to be dealing with numbers specific to 2dp. why not
just deal with an integer? and then divide by 100 when you need to 
display it as a string?

ie: 100.00 = 10000
    198.89 = 19889

many ways to pluck a chook as they say :) you'll find using integers
is even faster than using floating point :P especially on devices
like palm handhelds *g*

---
Aaron Ardiri
[EMAIL PROTECTED]
http://www.mobilewizardry.com/members/aaron_ardiri.php [profile]

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to