Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Double vs Numeric
Message
De
19/03/2012 11:40:59
 
 
À
19/03/2012 10:55:33
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01538640
Message ID:
01538684
Vues:
44
>>>>Hi Thomas, my main objective was optimizing disk storage size. The decimal precision requried for this data is definitely not going to be more than 4 digits. The largest value will not be more than 15 digits before the decimal. So a numeric field of 20,4 would handle all values. But this takes much more space than a double field type and hence my question.
>...
>>
>>Thomas, I have decided on double as it is safer in my existing app. I found a "gotcha" with currency which is calculations with currency field type cause type problems which require CAST() to convert. Working with double field type keeps the fields as numeric type.
>
>SET DECIMALS TO 4
>CREATE CURSOR TD ;
>	(	dDoub B;
>	,	cTran C(25);
>	,	cStr C(25)	)
>INSERT INTO TD (dDoub) VALUES (123456789012345.1234)
>INSERT INTO TD (dDoub) VALUES (123456789012345.1254)
>INSERT INTO TD (dDoub) VALUES (123456789012345.1257)
>REPLACE ALL cTran WITH TRANSFORM(dDoub)
>REPLACE ALL cStr WITH str(dDoub,20,5)
>brow
>
Thanks Thomas. I have understood how double field types work now. For my data needs double will still be ok. Thanks.
In the End, we will remember not the words of our enemies, but the silence of our friends - Martin Luther King, Jr.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform