Bankers Rounding

  • Naw, not going to continue down this path anymore. You have yet to admit you are wrong, you have yet to attempt to demonstrate that you aren't, you haven't acknowledged that your own test setup showed that the method works, nor have you shown any wilingness to run test cases that were written for you to show you the effectiveness of the rounding method, with regards to its intended purpose. In other words, I'm doing all of the work, even though you're the one who still has something to prove.

    Basically, the fun is gone, as it's not even a challenge any more. I'm not a fan of shooting fish in a barrel, and that's where we are at at this time. You're wrong, we all know you're wrong (I'm pretty damned sure that even you know you are wrong at this point, as you're not a stupid fellow), and I'll happily leave it there. It's your toolbox that will go without a valid tool that many find useful in many circumstances, not mine.

    Enjoy!

  • David M.

    I just wanted to let you know I that I copied the code you provided, made a few changes to see how many records rounded up and down using each method and then ran it several times.  It was interesting to note that the Convergence Round had a difference of about 1000 values between the number rounded up vs down (usually more up) the the standard round function where the difference was around 10,000 values and always in favor of rounding up.

    It was a good test, and I thank you for the time you took to write the code.

  • As one of the 5 still reading this thread, (I feel a duty to, ) or is it now less, here are my results from David F's excellent code

    InitialTotal           ConvergentTotal                 TraditionalTotal                         500081.5950            500082.8900                     500581.8500

    499895.4710            499894.1200                     500396.9500

    499846.0130            499847.4000                     500346.1300

    499991.8520            499990.5200                     500492.9500

    499833.6390            499834.7800                     500329.8600

    500184.5060            500183.3100                     500679.8800

    Which prompted this:

    select top 10 * from @TestTable

    where ConvergentRound  != TraditionalRound

    InitialValue      ConvergentRound   TraditionalRound

    ----------------- ----------------- ----------------

    .0250             .0200             .0300

    .3050             .3000             .3100

    .2850             .2800             .2900

    .1050             .1000             .1100

    .8450             .8400             .8500

    .8650             .8600             .8700

    .6850             .6800             .6900

    .6650             .6600             .6700

    .1850             .1800             .1900

    .2450             .2400             .2500

    Which led naturally to:

    select top 10 * from @TestTable

    where ConvergentRound = TraditionalRound

    InitialValue      ConvergentRound   TraditionalRound

    ----------------- ----------------- ----------------

    .3840             .3800             .3800

    .5270             .5300             .5300

    .9440             .9400             .9400

    .5190             .5200             .5200

    .9700             .9700             .9700

    .1830             .1800             .1800

    .9530             .9500             .9500

    .9020             .9000             .9000

    .9160             .9200             .9200

    .4520             .4500             .4500

    and on to:

    select count(*) from @TestTable

    where ConvergentRound  != TraditionalRound

    -----------

    49657

    select count(*) from @TestTable

    where ConvergentRound  = TraditionalRound        

    -----------

    950343

    So from a million, 50,000 are rounded up with ConvergentRounding, where as 100,000 are with traditional?  

    Oops, I asked another question.

    Dave J  


    http://glossopian.co.uk/
    "I don't know what I don't know."

  • As another of the 5, here are my results of ten runs (sorry if it doesn't fit on one screen or wraps):

    InitialTotal                            ConvergentTotal                         Traditionaltotal                        TotalRecords ConvergentCountDown ConvergentCountUp ConvergentCountSame ConvergentDifferene TraditionalCountDown TraditionalCountUp TraditionalCountSame TraditionalDifferene

    --------------------------------------- --------------------------------------- --------------------------------------- ------------ ------------------- ----------------- ------------------- ------------------- -------------------- ------------------ -------------------- --------------------

    499771.2510                             499768.4700                             500266.0000                             1000000      450609              449719            99672               890                 400856               499472             99672                98616

    500201.5200                             500201.7600                             500701.4000                             1000000      449762              450123            100115              361                 399798               500087             100115               100289

    500213.8930                             500207.5100                             500712.8400                             1000000      450735              449573            99692               1162                400202               500106             99692                99904

    499912.4620                             499911.1800                             500415.0100                             1000000      449854              449960            100186              106                 399471               500343             100186               100872

    500439.1420                             500439.6300                             500937.3600                             1000000      450120              450180            99700               60                  400347               499953             99700                99606

    499942.3670                             499943.3700                             500445.3500                             1000000      450256              450217            99527               39                  400058               500415             99527                100357

    499891.9270                             499891.2600                             500390.4500                             1000000      449761              450258            99981               497                 399842               500177             99981                100335

    500070.2240                             500068.2800                             500568.4300                             1000000      450241              449443            100316              798                 400226               499458             100316               99232

    500424.9460                             500424.1300                             500925.2400                             1000000      450162              449967            99871               195                 400051               500078             99871                100027

    499366.8340                             499364.8900                             499865.6800                             1000000      450111              449477            100412              634                 400032               499556             100412               99524

    If you take a few moments to edit the info in a text editor, what you will find is that using convergent round results in the number of rounds up and down are much closer together.  Using the traditional round, the difference using a million rows around 100000 rows more rounded up than down.

    Interesting, isn't it.

  • "So from a million, 50,000 are rounded up with ConvergentRounding, where as 100,000 are with traditional?"

    David,

    Your numbers are off because you compared the two rounding methods, not the rounding methods against the original value.

    With our test method, the convergent should generate the same number as the Initial Value about 10% of the time, so 100K or so.

    Convergent will be higher than initial value about 45% of the time, about 450k rows. It will also be lower about 45% of the time, which is why it is works well at removing bias.

    Traditional should, just as with convergent, generate the same number (i.e. no rounding applied) 10% of the time, so around 100k.

    Here's where traditional gets off track. It will be higher about 50% of the time, and lower about 40% of the time, due to the fact that a 5 in the thousandth's position will always round up in this method.

    Pop this code onto the end if you want to see if those results prove out on your end.

    SELECT

     ConvergentSame = Count(*)

    FROM

     @TestTable

    WHERE

     InitialValue = ConvergentRound

    SELECT

     ConvergentHigher = Count(*)

    FROM

     @TestTable

    WHERE

     InitialValue < ConvergentRound

    SELECT

     ConvergentLower = Count(*)

    FROM

     @TestTable

    WHERE

     InitialValue > ConvergentRound

    SELECT

     TraditionalSame = Count(*)

    FROM

     @TestTable

    WHERE

     InitialValue = TraditionalRound

    SELECT

     TraditionalHigher = Count(*)

    FROM

     @TestTable

    WHERE

     InitialValue < TraditionalRound

    SELECT

     TraditionalLower = Count(*)

    FROM

     @TestTable

    WHERE

     InitialValue > TraditionalRound

     

     

  • OK, as I can see you've getting where you're wrong, so you're trying to skip off the conversation not to be brought to admittance of your error on public.

    That's the way!

    Good luck!

    _____________
    Code for TallyGenerator

  • Sergiy,

    You must be living in your own world.  Anyone who takes the time to read all 126+ posts will come to the conclusion that we all gave up on you.  You refused to answer simple questions put forward to you.  You went off on tangents that had nothing to do with the topic at hand.  You refused to admit that your test, coded and ran by Dave M. proved you wrong.

    I guess for those of us who stuck around (even if we did get so frustrated we tried to walk away but in the end couldn't) this long just can't see continuing the argument any longer.

  • I was told there would be pie.  I want some pie.

  • Jeff, we can't have a thread this long without pie, so have some pie.

  • Lynn, I answered all questions.

    You're just too "minor in mathematics" to get it.

    So I was trying politely to repopulate you head with knowledge you missed in school and to reduce your "minority".

    But if you are happy to stay "minor" nobody can make you improve.

    _____________
    Code for TallyGenerator

  • You obviously don't know how to do anything but attack people that disagree with you.  And your twisting of the phrase "minor in mathematics" is so tiring.  All that means is I didn't have sufficient credits to have Majored in Mathematics.  It says nothing of my level of understanding in Mathematics.

    I have reviewed the many posts on this thread, and I am sorry, you have not answered the questions asked of you.  Maybe in your world you have, but I sure can't find them in this post.

    You can stop trying to "repopulate my head with knowledge I missed in school", as I didn't miss anything.  Your academic comments regarding ranges, etc I support.  I do not support nor agree in any way with your assertion that the Bankers Round function has no use in any application, and you still have not proved that statement to anyone reading this thread.

    If you have nothing more constructive to say, how about keeping it to yourself.

  • I asked simple question:

    If the smallest interval you can measure is 1ps then "midnight event" is an event happened between 0:00:00.000.000.000.000 and 0:00:00.000.000.000.001(excl)

    If the smallest interval you can measure is 3ms (in case of MS SQL Server) every event happened between start of the day and 0:00:00.003(excl.) will be recorded as 0:00:00.000 (because it happened before the system clock ticked) and would be interpreted by anyone reading the data as "midnight event"

    Is it right?

    It's not me who filled 2 pages after this with personal crap.

    _____________
    Code for TallyGenerator

  • And you have been asked what does this have to do with rounding?

  • You'll see.

    Answer 1st question and you'll be answered on 2nd.

    Is it the rule respectful people follow?

    _____________
    Code for TallyGenerator

  • The answer to your question: It Depends.  It depends on what you are tracking, why you are tracking it, so you can determine the approriate way to track it.

    So that also answer my question to you, it has nothing to do with rounding.  Prove me wrong on that statement.

Viewing 15 posts - 121 through 135 (of 373 total)

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