![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM General » View Thread |
Messages 1 to 4 of 4 total |
![]() |
Sun, Apr 4 2010 9:33 PM | Permanent Link |
Stephen Barker | Hi,
I was under the impression that currency fields automatically rounded the values to 2dp. However, when I apply a 20% margin to a cost price and then multiply by a large quantity (10000) I get an unexpected result: cost: ftcurrency value=0.74 sell: ftcurrency value=0.74+20%=0.888, but shows in dbsys as 0.89 quantity: ftfloat value=10000 selecting sell*quantity gives $8880.00 instead of $8900.00 Does this mean I have to round every calculation before storing into a currency field? (DBISAM 4, Delphi 2007) Steve |
Sun, Apr 4 2010 10:52 PM | Permanent Link |
Raul ![]() | The currency in DBISAM is actually a float (and thus not really a currency type) and you might be better off using BCD. Manual entry here : http://www.elevatesoft.com/manual?action=viewtopic&id=dbisam4&product=r&version=2007&topic=Data_Types_NULL_Support Look under Currency section, including the warning there and BCD suggestion. Raul |
Mon, Apr 5 2010 9:37 PM | Permanent Link |
Stephen Barker | Raul wrote:
The currency in DBISAM is actually a float (and thus not really a currency type) and you might be better off using BCD. Manual entry here : http://www.elevatesoft.com/manual?action=viewtopic&id=dbisam4&product=r&version=2007&topic=Data_Types_NULL_Support Look under Currency section, including the warning there and BCD suggestion. Raul Thanks Raul - I've been using DBISAM for many years but never realised that. I will now force rounding of all values prior to saving. Do most people use BCD for monetary values? It seems the storage overhead is quite a bit more, but are there any other issues? Steve |
Tue, Apr 6 2010 2:33 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Stephen,
<< Do most people use BCD for monetary values? It seems the storage overhead is quite a bit more, but are there any other issues? >> No, the only issue is the storage size. FYI, ElevateDB only uses 8 bytes per DECIMAL/NUMERIC (BCD) value, so it corrects the storage size issue. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, August 14, 2024 at 03:12 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |