Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Double vs Numeric
Message
From
19/03/2012 11:40:59
 
 
To
19/03/2012 10:55:33
Thomas Ganss (Online)
Main Trend
Frankfurt, Germany
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01538640
Message ID:
01538684
Views:
45
>>>>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform