dbTalk Databases Forums  

?Round( 1.5) = round( 2.5) - TRUE???

comp.databases.ms-access comp.databases.ms-access


Discuss ?Round( 1.5) = round( 2.5) - TRUE??? in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
John MacIntyre
 
Posts: n/a

Default ?Round( 1.5) = round( 2.5) - TRUE??? - 08-05-2003 , 05:56 PM






Hi,

Can anybody explain the rule for this?

Entered into the immediate window will give a result of TRUE. (Access 2000
SR1)

?Round( 1.5) = round( 2.5)
True

Thanks in advance ... this one kind of through me.

--
John MacIntyre
VC++ / VB / ASP / Database Developer
http://www.johnmacintyre.ca




Reply With Quote
  #2  
Old   
John MacIntyre
 
Posts: n/a

Default Re: ?Round( 1.5) = round( 2.5) - TRUE??? - 08-05-2003 , 08:56 PM






"Bob Quintal" <bquintal (AT) generation (DOT) net> wrote

Quote:
Thanks in advance ... this one kind of through me.

And your spelling threw me
Hi Bob,

You got me.

As a programmer, I can misspell everything and it will compile as long as I
misspell it consistently.

Regards,
John MacIntyre
VC++ / VB / ASP / Database Developer
http://www.johnmacintyre.ca






Reply With Quote
  #3  
Old   
John MacIntyre
 
Posts: n/a

Default Re: ?Round( 1.5) = round( 2.5) - TRUE??? - 08-05-2003 , 08:58 PM



Thanks Allen,

That's the kind of specific detail I was looking for.

Regards,
John MacIntyre
VC++ / VB / ASP / Database Developer
http://www.johnmacintyre.ca

"Allen Browne" <abrowne1_SpamTrap (AT) bigpond (DOT) net.au> wrote

Quote:
You used the Round() function without a 2nd argument, so it rounds to a
whole number.
? Round(1.5), Round(2.5)
2 2
Two equals two, so that's why the answer is True.

The Round() function tends to round odd numbers up, and even numbers down.
Statistically this removes the bias that would result from 5 values being
rounded down (12345), but only four being rounded up (6789). You will see
this pattern continue:
? Round(3.5), Round(4.5)
4 4
? Round(5.5), Round(6.5)
6 6

In reality, the Round() function is subject to the rounding errors that
always dog floating point numbers. For example, .545 rounded to 2 places
should round down to .54 because the 4 is even:
? Round(.545,2)
0.55
The solution is to coerce the data type to Currency (fixed point) or
Decimal
(scaled) before rounding:
? Round(CDec(.545),2)
0.54

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to the newsgroup. (Email address has spurious "_SpamTrap")

"John MacIntyre" <Please (AT) reply (DOT) to.group.thx> wrote in message
news:KDWXa.1506$ZV6.200670 (AT) news20 (DOT) bellglobal.com...
Can anybody explain the rule for this?

Entered into the immediate window will give a result of TRUE. (Access
2000
SR1)

?Round( 1.5) = round( 2.5)
True

Thanks in advance ... this one kind of through me.

--
John MacIntyre
VC++ / VB / ASP / Database Developer
http://www.johnmacintyre.ca





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.