Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where currency can play an ugly joke
Message
From
14/02/2005 17:48:34
 
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00986817
Message ID:
00986837
Views:
25
>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)
>>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform