How are you calculating the value (sorry I missed any early posts you made)?
Are you using floats? What are you doing with the result of the
calculation to get your final numbers? It sounds like your rounding error
is now just happening on the result of the subtraction, but it is still
rounding error. TCurrencyFields are just glorified TFloatFields so they
work exactly like doubles when you do arithmetic with them.
39.0 * 0.175 isn't really 6.83 its 6.825.
1561.0 - 6.83 is 1554.17 but 1561.0 - 6.825 is 1554.175.
Depending on how you arrive at your final value it is entirely possible that
1554.175 becomes 1554.18 since TCurrentField just uses a call to FloatToStrF
to display the value so it is essentially going like this
FloatToStrF(1561.00 - (39.0 * 0.175), ffCurrency, 12,2); ====> $1,554.18
Hope that helps. Sorry again if I missed some stuff from earlier postings.
>This is in reply to the rounding problem I had, but Ive now realised its
>a rounding error - its a minus error!
>Heres what happens.
>When I work out vat at 17.5% on a figure, say 39.00, it comes to 6.83
>This is correct. But now I need to minus the vat from my subtotal, say
>1561.00. The answer should be
> 6.83 -
>But I get 1554.18 - 1 penny out every time.
>But, when I add the VAT (I just did this as a test, it adds the VAT
>perfectly (1561.00 + 6.83) = 1567.83
>All my fields are calculated currency fields.
>Does anyone know what I am doing wrong..
>Would appreciate any help!