Round to Even (aka Banker''s Rounding) - The final function

  • What is it "work"?

    _____________
    Code for TallyGenerator

  • EXACTLY


    * Noel

  • It's funny nobody can provide a way to store 1/3 in computer.

    Is anybody here a programmer?

    _____________
    Code for TallyGenerator

  • Sergiy, I have wanted to ask this, but fear being called ignorant - but, I have had a couple beers -

    How do you store 1/3 in a computer?

    How would you solve this problem if you were tasked to do this, your business mandated it.

     Cory

    -- Cory

  • It's not that bad to be called ignorant.

    It's much worse to be such.

    Look couple of pages back and see how I store 1/3 in computer with different levels of precision.

    And believe me, I don't have any problems with it to solve.

    But David Burrows told these numbers are not 1/3.

    So I wonder - if anybody does know another way of storing 1/3 in computers? The proper one?

    _____________
    Code for TallyGenerator

  • We've already been over this. Remember in the other thread where you claimed that no programming language would return 2 for the expression (2/3) * 3? Remember where I not only stated that it did, but even gave you the code and environment so you could duplicate it? Remember ignoring the fact that I had again proven you wrong?

    As for the way to store 2/3 (or 1/3 as you're using here, thinking that it is somehow a completely different question than the one that we proved you wrong with) in the computer, if a person really wanted to it wouldn't be that difficult, since it's a repeating number. I could easily show x number of significant digits, a repeating number flag, and the number of digits from the right that repeat. Easy as pie.

    Here, I'll even show you a simplified example.

    Numeric storage area: .333333 (or even .3, for that matter, if you want it really simplified)

    Repeating number bit: 1

    Number of repeating digits: 1

    Done.

    Want a different one? How about 1/7?

    Numeric storage area: .142857

    Repeating number bit: 1

    Number of repeating digits: 6

    I should note that this discussion, while proving you wrong once again, has absolutely nothing to do with Banker's rounding, as Banker's rounding and traditional rounding both return the same value for .3 as well as .6.

  • I wonder where do you store "Repeating number bit" and "Number of repeating digits" in DECIMAL(12,6) cell?

    Would you mind to stick to real world, to real computers, not the one you imagine?

    _____________
    Code for TallyGenerator

  • You don't remember saying "It's funny nobody can provide a way to store 1/3 in computer. Is anybody here a programmer?"?

    I showed you a way, one of many ways, in fact. Oh, and yes, I'm a programmer. I'm pretty sure you're not. If you are, feel free to run that code I provided demonstrating that .NET 2003 handles (2/3) * 3 just fine, and report on the results.

    I can also code that storage mechanism on a "real" computer, whatever that means. It's not lilke data storage is rocket science, as many of us go back far enough that we had to write our own ISAM routines if we wanted to store data.

  • So, you can to code, but you never did.

    That means you have never stored 1/3 in computer for all your life.

    Cool.

    Is there anybody who has an experience of storing 1/3 in computer memory cell?

    I mean practical experience.

    _____________
    Code for TallyGenerator

  • > Want a different one? How about 1/7?

    What about irrational numbers?

    _____________
    Code for TallyGenerator

  • That wasn't your question, a question which I answered quite thoroughly. You seem to often change your question once we give a definitive answer, full of proofs, etc. Tell you what, why don't you spend some time creating a post in which you tell us everything you want answered, what answer you expect, and what answer will satisfy you. I'll even start with my own questions. Feel free to number your responses, as that might help you to remember to respond to the proofs that we've brought forward, which you seem to have trouble with. I understand, as sequential integers can be quite confusing, so we won't think less of you if you use the numbers as a guide.

    1. Have we proven to your satisfaction that there is indeed a programming language that returns the result "2" for the following equation (2/3) * 3)? If not, feel free to elaborate (or take the easy route, and actually run the single line of code provided to you to do so).

    2. Have we proven to your satisfaction that it is quite possible to write a function that will do what Banker's rounding is supposed to do, given the actual parameter value that it has to work with? If not, feel free to elaborate.

    3. Have we proven to your satisfaction that when looping through the numbers .0000 through .1999, with a step value of .0001, Banker's Rounding will exactly match the total results of the source numbers, while traditional rounding will have a higher total result? If not, feel free to elaborate (and remember that this was your test, that you were hoping to use to prove how bogus Banker's rounding is).

    4. Have we demonstrated to your satisfaction that it is quite possible for a computer to perfectly store 1/3, 2/3, 1/7, etc., if one so desired? If not, feel free to elaborate (keeping in mind that I did demonstrate just how easy it would be to do so).

    After answering those, feel free to list every single question you have, all in one place, outlining what response you will give once they have been answered satisfactorily. You can even number them to make it easier. Take some time with this, as your continous asking of bizarre and unrelated questions, getting answers with code, examples, and proofs, then when shown that you are mistaken, just taking some bizarre tangent with a new question, isn't fooling anyone. When shown that you are wrong, the proper response is something like "Oh, that makes sense now", or even "I guess that even I can be wrong on occasion", or the obviously difficult for you "Dang, I was wrong".

  • 1. "2" with which precision?

    If display does not show you following digits it does not mean they don't exist.

    "2.0" displayed on screen is not "2.(0)"

    So, your result does not prove anything.

    2. No.

    You never provided a function which accepts values with absolute precision, as BR required.

    3. No.

    I displayed that BR contradicts itself in 900 cases out of 20000.

    4. No.

    You have not demonstrated any actual data storage type in existing computer systems which can hold values the way you specified.

    And you did not name any existing CPU which can work with values stored that way.

    Now, can you provide us all with a way to store number "Pi" in a computer systems?

    Is there any way to work with number "Pi" in computers?

    If yes, what is the way?

    _____________
    Code for TallyGenerator

  • 1. "2" with which precision?

    If display does not show you following digits it does not mean they don't exist.

    "2.0" displayed on screen is not "2.(0)"

    So, your result does not prove anything.

    I did exactly what you asked. In fact, these are exact quotes.

    Sergiy: I'm waiting for a code supplying 2/3 to BR function.

    Me: Debug.Write(Math.Round(2 / 3, 3))

    Sergiy: (2/3) * 3 should be exactly 2.(0)

    Me: Yes, 2/3*3 in the environment I ran the tests in does indeed return 2.

    Sergiy: And you cannot pass 2/3 to the function.

    You cannot do it in any computer system. Using any computer language.

    Me: That was in VB.NET 2003. Feel free to try it.

    Sergiy: To enforce the order you need to specify it:

    SELECT (2./3) * 3                  --I'll note that you are actually correct here (hooray for firsts), which is why I followed up with...

    Me: Please run the statement "Debug.Write((2 / 3) * 3)" in the aforementioned environment. (Hint, it does indeed return 2)

    Since it did exactly what it was supposed to do, this last one you completely ignored and pretended you had never issued the challenge in the first place.

     

    2. No.

    You never provided a function which accepts values with absolute precision, as BR required.

    Nor do I need to. BR should work with whatever value it receives, just like the built in Round function does. It doesn't worry itself over what your original intent was, it simply works with the number it receives. All functions do that.

     

    3. No.

    I displayed that BR contradicts itself in 900 cases out of 20000.

    You did no such thing, which makes you a liar, but feel free to point it out where you think you did this, before I embarass you again and post the code to the test you formulated, the one that proved you wrong. Back it up, and I'll retract my statement that you are lying. If you're too lazy, I will happily post the code to the test, your post that defined the test, as well as the results. Want me to?

     

    4. No.

    You have not demonstrated any actual data storage type in existing computer systems which can hold values the way you specified.

    And you did not name any existing CPU which can work with values stored that way.

    Um, data storage types can be user defined, just like my earlier example. Have you never heard of structures? Structures will work on any CPU that has a C compiler. So pretty much any CPU will happily hold values in the way I specified. Hell, you could do it on a Commodore 64 if you really wanted.

  • 1.

    > Me: Please run the statement "Debug.Write((2 / 3) * 3)" in the aforementioned environment. (Hint, it does indeed return 2)

    What is the datatype returned by Debug.Write?

    What is the precision of that datatype.

    Because you used imprecise datatype you failed to return precise number.

    Sorry.

    2. BR requires values with absolute precision.

    See its definition.

    ... and ALL following digits are zero ...

    In order to use BR you need to supply all digits, not only those stored within precision your computer can handle.

    3. I understand you frustration, but it does not make you any better.

    BR rounds 0.1251 stored with 4 digits precision UP and stored with 3 digits precision DOWN.

    Sorry, but it's an error.

    Any function must return consistent result independent from precision supplied value was measured with.

    4. It does not.

    CPU accepts only binary representations of any number.

    There are no CPU's having data bus compatible to the format you specified.

    There are no memory cells to hold values according to your specification.

    You specified the way to build the value, not the way to store it in computer memory.

    ------

    And you forgot to provide data storage for Pi.

    Need a medicine from amnesia?

    _____________
    Code for TallyGenerator

  • 2. BR requires values with absolute precision.

    See its definition.

    ... and ALL following digits are zero ...

    In order to use BR you need to supply all digits, not only those stored within precision your computer can handle.

     

    So, perhaps, if the defination was changed, would that make this all go away, and everyone become one again in the world?

    ... and ALL following SUPPLIED digits are zero ...?

     

    -- Cory

Viewing 15 posts - 181 through 195 (of 377 total)

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