Re: Round()

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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


.



Relevant Pages

  • Re: Round()
    ... If you set the control source proprerty of a text box on a form to ... and that number would round down. ... Microsoft Access MVP ... I have a form which has a control that uses the following Control Source ...
    (microsoft.public.access.forms)
  • Re: Entropy sources under WinXP
    ... Better prompt thrones now or Tom will ... Never honour not while you're ... it'll beautifully gain the intervention. ... insufficient costs conceive round the productive studio. ...
    (sci.crypt)
  • Re: Control Source in a textbox
    ... I think yo misread my post, Tom. ... You use the control source to bind the control to the record source field. ... textbox to the Master_Data table. ... It is probably not necessary to use query in the DLookup. ...
    (microsoft.public.access.forms)
  • Re: Running Watch
    ... Tom B. wrote: ... But they don't generally round to the ... nearest integer minute, they truncate to the next lower minute (i.e. ...
    (rec.running)
  • Re: Dieter Schmidt Blowfish Paper Results
    ... > Tom St Denis wrote: ... >> You do realize that all key bits influence the sbox generation ... > subkeys for the third and fourth round do not depend on the first 64 ...
    (sci.crypt)