Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 5 of 5 total |
currency date value with 8 d.p. |
Fri, Dec 2 2016 8:15 AM | Permanent Link |
kamran | Hi
So what is the recommended way to handle a currency rate which has up to 8 decimal places? EDB has "Decimal" var type which has up to a scale of 4. Any ideas for what variable type that should be used that ensure accuracy as far as possible? Thanks Kamran |
Fri, Dec 2 2016 8:16 AM | Permanent Link |
kamran | sorry a typo: I mean rate *not* date
kamran wrote: Hi So what is the recommended way to handle a currency rate which has up to 8 decimal places? EDB has "Decimal" var type which has up to a scale of 4. Any ideas for what variable type that should be used that ensure accuracy as far as possible? Thanks Kamran |
Fri, Dec 2 2016 8:27 AM | Permanent Link |
Matthew Jones | kamran wrote:
> Any ideas for what variable type that should be used that ensure accuracy as far as possible? Me, I've found that the easiest way to handle things is by using "pence" or "cents" or whatever the relevant part is called. Simple old integers. This does of course depend on the maximum value that you will ever handle, but 64 bit int should give you a lot. If not, then keep them separately. You might also have to consider things like rounding, where you deal in tenths of a cent, but that is usually on a per action basis and not stored. Maybe other options exist, but never use anything "float". -- Matthew Jones |
Fri, Dec 2 2016 1:09 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | << So what is the recommended way to handle a currency rate which has up to 8 decimal places? >> Your two options are: use a large int, like Matthew indicated, or use a float/double. The float/double still has the possibility of floating-point representation issues, whereas the large int involves a bit more work in terms of displaying values. Tim Young Elevate Software www.elevatesoft.com |
Fri, Dec 2 2016 1:47 PM | Permanent Link |
kamran | Matthew and Tim * Thank you *
Tim Young [Elevate Software] wrote: << So what is the recommended way to handle a currency rate which has up to 8 decimal places? >> Your two options are: use a large int, like Matthew indicated, or use a float/double. The float/double still has the possibility of floating-point representation issues, whereas the large int involves a bit more work in terms of displaying values. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Sunday, May 5, 2024 at 10:18 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |