Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SET DECIMAL AND TRANSFORM
Message
From
17/12/1999 12:35:31
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
SET DECIMAL AND TRANSFORM
Miscellaneous
Thread ID:
00305350
Message ID:
00305350
Views:
56
I use SET DECIMAL TO 6 to display with TRANSFORM() number with 6 decimals. I
have note that "SET DECIMAL TO " modify the result. Why ? The FoxPro
documentation play:

SET DECIMALS
Specifies the number of decimal places displayed in numeric
expressions.


Example 1 with SET DECIMAL TO 6
============================
set decimal to 6
w_PRICE = 3.047
w_SC1 = 0
w_SC2 = 0
w_VAL = (w_PRICE*(100-w_SC1)/100)*(100-w_SC2)/100
w_result = round(105.000 * w_VAL,2)
? w_result
? transform(w_result,"999999.999999")

ERROR !!! w_RESULT is 319.93. The correct result is 319.94


Example 2 with SET DECIMAL TO 5
============================
set decimal to 5
w_PRICE = 3.047
w_SC1 = 0
w_SC2 = 0
w_VAL = (w_PRICE*(100-w_SC1)/100)*(100-w_SC2)/100
w_result = round(105.000 * w_VAL,2)
? w_result
? transform(w_result,"999999.999999")

OK !!! w_RESULT is 319.94.


Thanks,
Maurizio
Next
Reply
Map
View

Click here to load this message in the networking platform