[AccessD] Rounding Error - A2K

Gustav Brock Gustav at cactus.dk
Thu Dec 10 03:17:39 CST 2009


Hi Reuben

There is your explanation: cur * sng returns a double.

What you could do is to keep storing the percentage as a single. When using it for calculation, do:

  CurResult = CCur(CurAmount * CCur(100 * SngPercentage) / 100)

This will calculate using your six decimals and (with CCur) round the result to four decimals.

/gustav


>>> accessd at gfconsultants.com 10-12-2009 03:16 >>>
Stuart and Charlotte, I'll play with the single/double issue.

The dollar amounts are all currency.

The percentage (.25xxx) is a single.  Not sure why as this is the first time
I've ever used a single.
All these years and I've never used single and the first time I do it BITES
me.
I wanted to use currency for the percentage, but the state defines these
rates to 6 decimals.

Reuben Cummings
GFC, LLC
812.523.1017






More information about the AccessD mailing list