Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Diff. between Numeric with precision, Currency and Doubl
Message
 
À
10/06/2003 04:13:58
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00798235
Message ID:
00798288
Vues:
28
Thanks for responding Cetin. The reason I had used Currency in the first 2 fields was just that. I wanted to have a flexible field, as I had bad experience in FPD where I had to use Num 12, 2 for Amount, Qty., Rates. Then came the reason where rate fields had to have 12,4 and Qty. had to have 12,3 and I had a lot of work to do.

So now that I am using VFP I thought that I will use Currency as it already had 4 decimals. Now history repeats itself, this time I need 6 precision <g>.

In your opinion can I use double as a general purpose field for Amounts, Rates, Qty., and such special fields. But the problem was that at table design time I had to specify precision. This got me confused. Unlike currency, in which I knew I will get 4 precision. Here the default was 0 precision. Supposing I use say 6 precision in all my fields for double. Then in the future when History repeats and I required 8 precision, will just changing the precision in the table affect my older entered values as 6 and less precision?

>>Hi all
>>
>>Could anybody kindly explain the differences between a Numeric with precision, Currency with it's fixed precision of 4 and Double which again asks for precision.
>>
>>I was under the impression that Double will be like Currency but it is asking for precision.
>>
>>Also what will be the case when I have to calculate between such numbers. Generally I have used Currency for Amounts and Quantities. In a special case recently I had to use Numeric with 6 precision. It seems that is causing some rounding upto Currency precision. What if I had used Double in such as case?
>
>A numeric is up to 20 digits (counting . as a digit) using the same space for integer and decimal part. Numeric values are stored on disk as they are shown are screen (ie: 10.20 is stored as 10.20 if you check with a hexeditor). It's 8 bytes only in memory and 1-20 bytes in table (stored as shown). Float is almost the same as a numeric.
>A currency value has 4 fixed decimal digits and can hold values apprx. +/- 9E15. Stored as 8 bytes binary.
>A double is a double precision floating point number which in VFP can hold the maximum range and stored as 8 bytes. Has a higher precion than others.
>Double and Float are the datatypes that only could be used as field datatypes.
>
>You can check their capacities, how stored etc in 'Data and field types'. In practice for tables I use Double and Integer only. I could hold any numeric with decimal, money, float as a double and any numeric where I don't need a decimal as an integer (if I need a value that an integer can't hold then I use double for that too). It works great as during calculations I don't lose precision (within VFP limits) and in cases I seem to lose it's generally only the display losing the precision. Numerics as I once experienced earlier with FPD26 was losing its precion on its integer part (over 17-18 billion values were rounding to billion w/o my will - changing type to Float fixed).
>Currency isn't much of a use (personal opinion). I could have it in my table as a b(4).
>Cetin
Regards
Bhavbhuti
___________________________________________
Softwares for Indian Businesses at:
http://venussoftop.tripod.com
___________________________________________
venussoftop@gmail.com
___________________________________________
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform