Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding of currency correctly 1

Status
Not open for further replies.

Moss100

Technical User
Aug 10, 2004
579
0
16
GB
Hello,

I have a form that calculates a tax rate. I need the final number to be fixed to 2 decimals exactly.

I have a textbox called txtTaxCalc, which is set as currency to 2 decimals.

In txtTaxCalc control source i have the following: = 90.9/100*5

This will give an answer of £4.545 (initially it will display £4.54, but when I click into it the number expands to £4.545.

The correct answer for my onward calculation should be £4.55.

I have then tried = Round(90.9/100*5,2) but this gives and answer of £4.54

I'm a bit stuck - please could someone help me to get to the correct answer - i.e. £4.55 without any further decimals.

Many thanks Mark
 
From site Rounding in Access:

Bankers rounding

The Round() function in Access uses a bankers rounding. When the last significant digit is a 5, it rounds to the nearest even number. So, 0.125 rounds to 0.12 (2 is even), whereas 0.135 rounds to 0.14 (4 is even.)

The core idea here is fairness: 1,2,3, and 4 get rounded down. 6,7,8, and 9 get rounded up. 0 does not need rounding. So if the 5 were always rounded up, you would get biased results - 4 digits being rounded down, and 5 being rounded up. To avoid this, the odd one out (the 5) is rounded according to the previous digit, which evens things up.

(I hope this will help you...)


---- Andy

There is a great need for a sarcasm font.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top