Roundup Problem

  • Thread starter Thread starter KIT LAU
  • Start date Start date
K

KIT LAU

Hi,

I have a query that calculate a field:

results:FORMAT((num*2.013), "Standard")

The num is 205. The results should be 412.665. It should
be 412.67 after FORMAT. However, I dont know why it's
412.66.

Can anyone help?

Thanks
 
Rounding is towards the nearest even number.

If you round 1 - 5 down and 6 - 9 up, you create a bias.
You have five digits to round down, and only four upwards.
The accepted solution is to round the 5 downwards if the previous digit is
even, and upwards if the previous digit is odd.

Access rounds 412.665 downwards because the previous digit is even.
It rounds 412.675 upwards because the previous digit is odd.

(Well, that's what is is supposed to do. Occassionally the imprecision of
floating point numbers interferes with that general rule.)
 
If you want to break with the standard, you will need to write your own
rounding function to handle that specifically.
 
Back
Top