round of calculation

G

Guest

I have a problem with differences in 2 reports.
One report is an invoice the other is the turnover report of the invoice.
the difference between the report is 0,01 cent. I found the diffrence but I
don't understand it.

the calculation in the invoice is
round(1.5 * (19/100),2) the answer is 0.29
the calculation in the report is
round((1.5 * 19)/100,2) the answer is 0.28

Why is there a diffrence?
And which calculation is the best to use?
 
J

Jim

Hi,

Sinde the first calculation round(1.5 * (19/100),2) yields the correct
answer it is the best to use. Excel returns .29 to both calculations which
is correct. I would trust Excel over Access on this type mathematics.
Access probably has a BCD (Binary Coded Decimal) problem embbed deep inside
its code.

I hope that helps.

Jim
 
A

Allen Browne

You are dealing with an abberation with floating point numbers. To solve
that problem, use the fixed point type, Currency.

By converting the result to Currency before rounding:
Round(CCur(1.5 * (19/100)),2)
it should force the 3rd place (5) to be rounded towards the even number (8),
yielding 0.28.

The brackets are not the issue, except in so far as they affect how the
floating point result is reached.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top