Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Should I use currency or num(14,2) ?
Message
From
19/10/1999 15:47:33
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00273031
Message ID:
00278435
Views:
14
>Does it make more sense to use the currency type or the numeric (14,2) ? It is for North America. Does it mater ?
>

Yes it does, especially when discounts or fractional cents are a factor. The currency data type has a fixed number of decimals (4) to the right of the decimal point, regardless of the number's magnitude, and will force any computation containing a currency data type to that precision, which can be murderous for certain types of computations. If you're dealing with fractional computations, especialy multiplication/division/transcendentals, don't use the currency type.

Currency pays off big time with addition where the magnitude can vary greatly; very large numbers expressed as a floating point value sometimes have inexact values - IOW, you may run into situations where two large integers are indistinguishable when represented as a floating point data type. The currency type avoids many of the rounding problems encountered with floats as well.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform