Re: Round()
- From: "Allen Browne" <AllenBrowne@xxxxxxxxxxxxxx>
- Date: Thu, 12 Feb 2009 23:58:30 +0900
The Round() function in Access uses bankers rounding.
Details:
http://allenbrowne.com/round.html#BankersRounding
As Tom points out, there is also a matter of tiny inaccuracies in floating point values that can give an answer different to what you expect:
http://allenbrowne.com/round.html#FloatingPointErrors
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"RonaldoOneNil" <RonaldoOneNil@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DC32FB6E-105D-47C3-8662-074EA5DF9D41@xxxxxxxxxxxxxxxx
But, if you type ? Round((100+15.5)*0.07,2) you get 8.09
If you set the control source proprerty of a text box on a form to
=(100+15.5)*0.07
it displays as 8.085. On a calculator it shows 8.085
If you then put this code behind a button click
Msgbox Round(textboxname,2)
8.08 is displayed ??
"Tom van Stiphout" wrote:
On Thu, 12 Feb 2009 05:54:53 -0800, Question Boy
<QuestionBoy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
Type this in the Immediate window:
?Round(8.085,2)
8.09
Conclusion: what is DISPLAYED as 0.085 is actually a fraction less
than that, and that number would round down.
-Tom.
Microsoft Access MVP
>I am seriously confused and need someone to explain the Round() >function.
>
>I have a form which has a control that uses the following Control Source
>
>=([Sous-total]+[Sous-total Mechanique])*0.07
>
>Which returns a value of 8.085 (in one case)
>
>I then mod the Control Source like
>
>=Round(([Sous-total]+[Sous-total Mechanique])*0.07,2)
>
>and it now returns 8.08?????
>
>What am I doing wrong? Why is it not returning 8.09? How can I make >it?!
>
>Thank you.
>
>Confused and Frustrated!
>QB
.
- References:
- Round()
- From: Question Boy
- Re: Round()
- From: Tom van Stiphout
- Re: Round()
- From: RonaldoOneNil
- Round()
- Prev by Date: Re: Round()
- Next by Date: New field added to form not updating in the table
- Previous by thread: Re: Round()
- Next by thread: Combo Box to Filter query
- Index(es):
Relevant Pages
|