Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HELP:VFP60 - SP4 Has anyone Seen this....
Message
From
19/01/2001 21:40:24
 
 
To
18/01/2001 14:43:08
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00465316
Message ID:
00466096
Views:
12
>>>>Make a table with two fields one currency and the other numeric with three decimals
>>>>Put this value in the fields 27.0760 in currency and 27.076 in numeric
>>>>Do a transform(CurrencyField,'$,$$9.99') value = 27.07
>>>>Do a transform(NumericField,'$,$$9.99') value = 27.08
>>>>
>>>>Does any body have a work around for this or know why?
>>>>
>>>>
>>>>Shawn Dorion
>>>>E : Shawn@OurSoftware.com
>>>>
>>>>Web: www.oursoftware.com
>>>
>>>The fact that you are transforming a number field from three decimals to two forces a round function on the transformation. With currency fields, the accuracy is preserved, but the value is truncated.
>>>
>>>?transform(round(numbs,3),'$,$$9.99')
>>
>>This behavior is related to SET DECIMALS
>>
>>Try: SET DECIMALS TO 5 and see what kind of results you get.
>
>Actually, it's not affected by SET DECIMALS if you specify the TRANSFORM() format.
>If you don't specify it - TRANSFORM(CurrencyField), then it is affected by SET DECIMALS

What you're actually seeing is the effect of the currency datatype, which has a fixed precision of 4 decimal places and known rounding behavior to round up to the next 1/100th when the third decimal value is .005 or larger.
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