And I'll go even further than that. :-) When dealing with money, remember that not everyone uses dollars. The Turkish Lira, for example, currently trades at 1,414,000 Liras to the US dollar. If you were to represent a monetary amount using a 32-bit integer, the maximum number of Lira you could represent (4,297,967,295) comes to only $3037.46 US.

So you might want to consider using a "long long" data type, or even wrap up your money handling routines into a C++ class that hides the actual type.

-- Keith


At 4:56 PM -0700 12/26/03, Phil Hartley wrote:
Dave

I would go a bit further than the other replies.  When you're dealing with
monetary values, you should NEVER use floating point.  It's implicitly
inaccurate.  Use either Integer arithmetic or Decimal arithmetic which
probably means that you should use Integer arithmetic on the Palm.

Phil

P.S.  I actually have seen FP being used in an application written in a
bank.  I won't mention which one.

"Dave Mottorn" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
 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.

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

Reply via email to