Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where currency can play an ugly joke
Message
De
14/02/2005 17:48:34
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00986817
Message ID:
00986837
Vues:
24
>Which is why you should always MTON before using any currency field in a calculation. I think this is documented but I can't remember where right now. In any case
? MTON( c)*(1/n)
gives the expected answer.
>
Hi Rick, the expected is $3 ( if you have 9 dollars and divide in 3 parts .... )

Then a possible way is
( but I do not have much confidence when I begin to make the accounts with the float of VFP )
? NTOM(MTON($9)*(1/3))
This is ok for me ( and you ? ) but when Bill G. have to split they patrimony:
? ($9999999999999.9999/3)*3
?  NTOM(MTON($9999999999999.9999)*(1/3))*3
Fabio


>
>
>
>>Currency is the only VFP exact decimal number.
>>
>>When you do a multiply or a division you can have some surprises.
>>
>>
>>c=$9
>>n=3
>>
>>? c/n
>>? c*1/n
>>? c*(1/n)
>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform