Bankers Rounding

  • Wrong answer.

    Can you provide any example of such dependency?

    _____________
    Code for TallyGenerator

  • What answer is wrong?  The one that states It Depends or the one where this has no relevance to discussion about rounding.  You talk in half sentences and abstractions that have no meaning.

    Try stating exactly what you are trying to prove, then prove it.

    Try this: Show me why you should never use the Round2Even function and should always use the Round function.

    Just to be sure you understand, NO ONE in this thread has said that you should ONLY use one method all the time.  We have simply stated that there are times when each method is appropriate.  You have failed to prove any of us wrong.

  • I asked for an example of dependency.

    Anyone who is capable to think would conclude that it was about "It depends".

    > Try this: Show me why you should never use the Round2Even function and should always use the Round function.

    That's actually what I'm trying to do.

    And what you're trying to avoid in all means.

    Stay on track. It's only 5 steps to go.

    Simple question - simple answer. Is it that hard for you?

    _____________
    Code for TallyGenerator

  • I can't answer your question if I don't know the requirements.  That is why the answer to your question is "It Depends".  No requirements, no answer beyond that.

    I am staying on track.  I have tried to develop changes to systems for people who kept moving the target, just like you are now.  Set the requirements up for what you want, then you will get the answers based on those requirements.  It is the appropriate method for developing even the most simplest of programs.

  • OK, repeating in other words:

    You have a record of "midnight event" happened on 00:00:00.000.

    Time was recorded with some timer having resolution 00:00:00.003.

    Do you agree that any event happened between 00:00:00.000 and 00:00:00.003(excl.) will be recorded by such system as "midnight event"?

    _____________
    Code for TallyGenerator

  • Yes.  Now, stop dragging it out, and just prove your point, if you can.

  • OK, now step 2.

    You have record of mass of some metal piece 1.000 kg measured by some device having resolution (or precision, in other words) 1g.

    It means that this value indicates that actual mass of that metal piece may be any value between 1.000(0) and 1.000(9).

    Is it right?

    _____________
    Code for TallyGenerator

  • Sergiy, no more questions and answers.  This is the "fish or cut bait" time.  Prove your point or concede.

     

  • Do you agree with the statement above or not?

    _____________
    Code for TallyGenerator

  • Either you can prove your point with out going through "twenty (or five or ten or how ever many)questions" or you can't.  Fish or cut bait, prove your point in the next post or concede.

    Your choice, not mine.

     

  • OK, I see you agree.

    Another measurement indicated that mass of another piece of metal is 1045 g.

    We cannot measure with better precision, this is only value we've recorded.

    Despite the actual mass of that piece was, say, 1045.72 g.

    Now someone, who is selling this metal, charges for it $1 per kg.

    1.045*$1 = $1.045.

    Is this number precise?

    No? ????????. It indicates any amount between $1.045(incl.) and $1.046(excl.).

    We indicate $1.045 just because we cannot measure and indicate more precisely.

    Actual cost of this piece is $1.04572, but our system just does not display it.

    Now we came to rounding.

    We need to round to 2 decimal digits.

    Which way $1.045 must be rounded?

    Bankers Rounding will bring result 1.04.

    Traditional Rounding will bring result 1.05.

    BR comes to this because it assumes that 1.045 = 1.045(0)

    In real life it’s not true. In fact 1.045 indicates any number between 1.045(0) and 1.045(9). Obviously all numbers from this range (including our actual case of 1.04572) must be rounded to 1.05.

    Let’s check if it’s right.

    Assume we buy 10 identical pieces.

    If we multiply price per piece we’ll get:

    BR – $10.40

    TR – $10.50

    But if we go proper way and measure the mass of all metal we’re buying we’ll get total mass 10457g. Total cost = $10.457.

    Bankers Rounding inaccuracy is ABS($10.457 - $10.40) = 0.057

    Traditional Rounding inaccuracy is ABS($10.457 - $10.50) = 0.043

    Conclusion: Bankers Rounding always more inaccurate than Traditional Rounding.

    Reason: false assumption of absolute precision of “precise” numbers.

    _____________
    Code for TallyGenerator

  • One example does not prove the point.  Look back further in these posts.  Your own test setup, coded by David M. and run by several of us shows the Bankers Round (Convergent Round) to be more accurate over a large sample.  Take 1,000,000 random numbers between 0.0000 and 1.0000.  Based on a statistical average that would distribute these numbers equally around 0.5, you would make an assumption that adding these numbers together would come up to around 500,000.  Using the Bankers Round function we find that we come much closer to the actual total (a little high sometimes, a little low others) but the traditional round function is consistantly higher.  Which is more accurate?

    Each has its appropriate uses.  It is our job to determine which is the most appropriate in each circumstance we face.

     

  • Banker's rounding is used to even out problems caused when rounding is applied to a domain that is (hopefully) distributed across many values.   It's a pretty simple concept.

     

    I went to the nut store to buy some nuts.

    Pistachios are 4.79 per pound and Cashews are 4.89 per pound.

    I bought 1/2 pound of Pistachios and 1/2 pound of Cashews.  One could figure the average price and charge me for a pound at the average price of 4.84 per pound.  This is how much it should cost.

    If I use traditional rounding, I pay 2.40 per half pound for the Pistachios and 2.45 per half pound for the Cashews.  mmmmm  Cashews.

    So I paid 4.85 per pound for the nuts, and I am sad because I got jacked out of a penny.

    Now if we use this fancy Banker's rounding, I will pay 2.40 per half pound for the Pistachios and 2.44 per half pound for the Cashews.

    I pay 4.84 for the two half pounds and I exit the store gleefully.

     

     

    Sergiy, you gave a bad example.  Try again. 

  • Sergiy, you also are applying the Bankers round function incorrectly.  Your number, $1.04572, rounded to 2 decimal places will round to 1.05 using both methods.  The Bankers round looks at the numbers AFTER the 5 in 1.04572 to decide if it should round up or down in this case.  The number 1.04500 will round to 1.04 using the Bankers round, while the traditional round will take it to 1.05.  Now, 1.03500, will round to 1.04 using both methods.

    So, not only is your example bad, you did not even apply the math correctly.

  • Lynn, you're not only minor in math, you've got problems with reading as well.

    There is no $1.04572 number recorded in database. You can measure and record only with 3 digits precision (not mathematically right expression, but easier to understand for "minors", don't want to start another lection about precisions).

    So, it's $1.045 is available. And you don't have an idea what's next.

    It could be anything - 00, 01, ..., 99. And event if it's 00 then next number may be not zero.

    The only value to be rounded down by BR is 1.045(0).

    But what's the probability there is this number behind 1.045?

    There is infinite number of actual numbers represented by 1.045.

    And only one of them we ae looking for.

    Probability = 1/infinity = 0.

    So, event of number 1.045(0) is mathematically impossible, and 1.045 every time must be rounded using consideration it's not 1.045(0) - to 1.05

    _____________
    Code for TallyGenerator

Viewing 15 posts - 136 through 150 (of 373 total)

You must be logged in to reply to this topic. Login to reply