Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ROUND()
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00342568
Message ID:
00343359
Vues:
31
>>I don't agree that the ROUND() function should disregard the decimals setting, as this can make a big difference. If I wanted the result of my sum to be 9.5, and I want to round it off, then I don't think it should be changed to 9.46, and then rounded off.
>>
>Round() doesn't respect the Decimal setting because it has its own which over-rides the environment setting.
>
>To All,
>Try the following:
>set decimal to 16
>? 7/74*100 && result 9.4594594594594600
>set decimal to 1
>n = 7/74*100
>? n && result 9.5
>? round(n,0) && what do you get? my result 9
>
>This is the problem Kevin has been experiencing and I haven't caught on until now. This is a BUG!!
>
>It appears the value is not being stored to the memory variable, but the expession itself. Then whenever you need it afterward, VFP reevaluates it.

Larry,

It's NOT a BUG. According to VFP help "SET DECIMAL TO specifies the number of decimal places displayed in numeric expressions". As you can see it doesn't affect calculations.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform