Posts: 4,708
Threads: 224
Joined: Apr 2022
Reputation:
322
It's allot of people's nit!
Luke explained it as bankers rounding, so that not every 5 is rounded up but every other 5 is.
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever
Posts: 242
Threads: 13
Joined: Apr 2022
Reputation:
6
Round() function always round to lower value
Posts: 315
Threads: 16
Joined: Apr 2022
Reputation:
43
From the wiki:
The _ROUND function rounds to the closest even
INTEGER,
LONG or
_INTEGER64 numerical value.
It may be a bit confusing wording, as _ROUND does not always choose the even result, it only does so when starting from .5
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Posts: 64
Threads: 12
Joined: Apr 2022
Reputation:
5
05-13-2022, 12:45 AM
(This post was last modified: 05-14-2022, 08:32 PM by dcromley.
Edit Reason: corredt
)
> bplus: "Luke explained it as bankers rounding, so that not every 5 is rounded up but every other 5 is."
Yes, it is (now) clear that _ROUND rounds n.5 up if n is odd and down if n is even.
Int(n.5) always rounds n.5 up. [ Edit: WRONG ! ] SMcNeill's Round##(n.5,0) also always rounds up.
> aural: "Round() function always round to lower value"
Wha--?
Posts: 4,708
Threads: 224
Joined: Apr 2022
Reputation:
322
(05-13-2022, 12:45 AM)dcromley Wrote: > bplus: "Luke explained it as bankers rounding, so that not every 5 is rounded up but every other 5 is."
Yes, it is (now) clear that _ROUND rounds n.5 up if n is odd and down if n is even.
Int(n.5) always rounds n.5 up. SMcNeill's Round##(n.5,0) also always rounds up.
> aural: "Round() function always round to lower value"
Wha--?
I'm sure just a mis-word but INT() always rounds down for positives anyway.
BTW that's another crazy issue to worry about, rounding with negatives. I'm not sure you always want to add .5 in SMcNeill's Round##()
724 855 599 923 575 468 400 206 147 564 878 823 652 556 bxor cross forever