>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