Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accurate Numeric Calculation
Message
From
02/11/1997 12:49:02
 
 
To
02/11/1997 11:36:14
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00057855
Message ID:
00057865
Views:
35
>I need to convert from one currency to another and I would like the results
>to
>be accurate no matter which way I calculate. I have a problem in converting
>from one currency to another and back to its original value and there is
>some
>discrepency (Eg. $10 x ex-rate = $18.90, then
> $18.90 x ex-rate = $9.99[should be $10
>originally] )
>
>where ex-rate is 99.9999 format.
>I tried to get the whole value by multi it with 100 or 10000, etc...
>Pls help and thanks in advance

There must be something wrong in your code, or probably the lenght of your fields.

What I mean is that if your exchange rate is a memory variable, there should not be any problem, as the memory variables are automatically adjusted to the whatever decimals they need, but if you are using tables as the data source, you need to have a lot of decimals in those fields in order to create large & accurate calculations, (Up to ten decimals).
You could also use the ROUND() function to force numbers to be rounded to whatever decimals, and you will always get the same result.

If you want send me your code to my e-mail, and after I analize it, I will send you an answer

REGARDS
Mao
intelisoft Corporation
Previous
Reply
Map
View

Click here to load this message in the networking platform