Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SET DECIMAL AND TRANSFORM
Message
De
17/12/1999 12:35:31
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
SET DECIMAL AND TRANSFORM
Divers
Thread ID:
00305350
Message ID:
00305350
Vues:
55
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform