LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 837
Default Round doesnt work the way it is expected

The VBA Round() function uses what MS calls "Banker's rounding"
http://support.microsoft.com/kb/194983
which rounds to the nearest rounded number, but handles ties differently
than you were expecting. You expected ties to always round up, which can
introduce a rounding bias. The so called "Banker's rounding" tries to
roughly balance the number of times that ties round up or down by rounding
ties so that the final rounded digit is even. This has been the ASTM
standard for rounding since the early 1940's and has been best practice for
nearly a century.

Nick is partly right, in that the IEEE 754 standard specifies that rounding
of internal binary numbers be to an even final digit. IEEE 854 extends this
to natively decimal calculations, but I don't think that it applies to how
you round the decimal representation of natively binary calculations. About
10 years ago, an informal survey of computer languages found them about
evenly divided as to which rounding method they implemented.

Why MS calls it "Banker's rounding" is a mystery to me, since as far as I
can determine, bankers have never used it. I would welcome an explanation of
the history of this name, evidence that bankers have ever used it, or
pre-1940 references to this type of rounding.

Jerry

"Carlo" wrote:

Hello all

i'm a little confused here. Hope somebody can help me.
With following code:
---------------------------------------------------------
Sub Whyyyyyyyyyyyyyyyyyy()
x = 1.5
For i = 1 To 4
Debug.Print "(" & x & " * " & i & ") = " & x * i & " == Round(" & x
* i & ") = " & Round(x * i, 0)
Next i
End Sub
---------------------------------------------------------
VBA returns me:
------------------------
(1.5 * 1) = 1.5 == Round(1.5) = 2
(1.5 * 2) = 3 == Round(3) = 3
(1.5 * 3) = 4.5 == Round(4.5) = 4
(1.5 * 4) = 6 == Round(6) = 6
------------------------

Why is Round(1.5) = 2 and Round(4.5) = 4 ?????

I don't really get it!


Thanks for any help

Carlo



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sumproduct issues SteveDB1 Excel Worksheet Functions 25 June 3rd 09 04:58 PM
deleting round function BorisS Excel Worksheet Functions 2 December 19th 06 10:58 PM
Moving a sheet from one work book to another? WTG Excel Worksheet Functions 1 November 3rd 05 07:12 PM
My links no longer work . . . mike Excel Discussion (Misc queries) 8 October 27th 05 11:59 PM
Work Rota - Do I need a formula? dataheadache Excel Discussion (Misc queries) 11 October 3rd 05 10:53 PM


All times are GMT +1. The time now is 10:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"