Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Serious Error with Currency Data Type
Message
De
18/01/1999 13:02:35
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00177250
Message ID:
00177262
Vues:
32
>Calvin,
>
>According the the VFP5 help file:
>
>If you specify more than four decimal places in a currency expression, Visual FoxPro rounds to four places before evaluating the expression.
>
>So it's working as documented the 0.41116 is being rounded to 0.4112 before the expression is evaluated. You may have to take the currency numeric to get the precision you need during the operation.
>
>>I have found that using currency data types results in incorrect answers for simple math operations. For example, if I have a currency value and multiply it by a decimal value it appears that foxpro converts the decimal value to a currency type before the operation rather than after the operation. Test the following on your machine:
>>1050.45 * .41116=431.9030
>>$1050.45 * .41116=431.9450
>>
>>This has got to be an error and it renders currency virtually useless without doing mton conversions everywhere.

Another case of failing to RTFM...just be glad we're not doing C - I'm in working today because someone failed to properly cast some pointers to structures before doing some (in theory) simple pointer math....
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform