James Button
jamesbutton at blueyonder.co.uk
Tue Jul 9 09:02:01 CDT 2013
AFAIK - though it would be advisable to check the implementation within the app & software under your OS and hardware ACCESS DOUBLE is 8 byte storage - but 2 decimal points of precision ACCESS Currency being 14 digit integers, and optionally 4 decimal places Is that Money in MS SQL ? VBA Currency does 12 digit integers, and up-to 4 decimal places, so is inadequate for currency conversions where the exchange rates, and associated $/£ (etc) values are large. Remembering that, just for the exchange rates you need to hold a fully accurate answer to n/999,999,999,999 and 999,999,999,999/n such that when the 2 are multiplied together you get the exact value of 1, As in ABS((n/999,999,999,999)*(999,999,999,999/n)-1.000000))<0.00000000000000001 (or whatever limit on accuracy is acceptable to your organisations regulatory body ) is true In VB you now have (if implemented on the VB for your hardware) the 14 byte Decimal datatype see http://www.ehow.com/list_6701555_numeric-data-types-access.html And, it's also worth considering the incongruities in application handling of small values such as that detailed in http://www.tutcity.com/access/precision-numeric-data-stored-variant.48028.html The problem that needs to be considered is can the field as defined, and any intermediate fileds the compilor assumes it can use, hold the answer to your arithmetic needs. And does the answer for the app on this OS and hardware where you did the development also apply to each, and every new/old/alternative environment where it is going to be run? JimB ----- Original Message ----- From: "Stuart McLachlan" <stuart at lexacorp.com.pg> To: "Access Developers discussion and problem solving" <accessd at databaseadvisors.com> Sent: Tuesday, July 09, 2013 1:44 PM Subject: Re: [AccessD] Hooking into APIs of supplemental vendors In Access, the other option is Currency. Which is an 8 byte scaled integer -- Stuart On 9 Jul 2013 at 14:33, Gustav Brock wrote: > Hi Jim > > I've found that in the cases where you need a "Double of a Double", the > subdatatype of Variant, Decimal, would do. > To create a Decimal, you need CDec: > > Dim varDecimal As Variant > varDecimal = CDec(<SomeDecimalNumber>) > > /gustav > > -----Oprindelig meddelelse----- > Fra: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] På vegne af James Button > Sendt: 9. juli 2013 09:24 > Til: Access Developers discussion and problem solving > Emne: Re: [AccessD] Hooking into APIs of supplemental vendors > > Hi, > > A word of warning - > > I worked on an investment banking system with inbuilt currency conversion, > and had to rewrite a module to use the equivalent of 'doubles' because > some > currencies hit 9 places to the £ that means that a simple conversion > to/from > £ needed 18 places of accuracy > > Not useing that accuracy may not be a practical concern for the investor, > but it sure can make it impossible to balance the accounts. > £100,000.00 invested at 200,000,000,000 to the £ and then 'sold' at - say > 185,500,000,000 > > JimB > > > -- > AccessD mailing list > AccessD at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/accessd > Website: http://www.databaseadvisors.com > -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com