June 25, 2007 at 9:44 pm
And what if the first digit BEYOND supplied precision is not zero?
How can you tell?
And if it's not, it must be rounded up, right?
_____________
Code for TallyGenerator
June 26, 2007 at 2:13 am
Sergiy,
You go to your local store and purchase an item priced at 33 cents (marked as 0.33)
You give the item to the storekeeper plus 1 dollar
The storekeeper writes down on a piece of paper
1 - 0.33 =
What is the answer the storekeeper writes down?
How much change do you get?
Is the answer and the change given, an error?
Far away is close at hand in the images of elsewhere.
Anon.
June 26, 2007 at 3:33 am
Davis,
you forgot to show how 1/3 is stored in your computer.
Please, waiting for you response.
_____________
Code for TallyGenerator
June 26, 2007 at 5:48 am
1/3 isn't a number, it's two numbers and an operator - an expression. Any child could tell you that. So why ask how to store 1/3 as a single number when it isn't, it's a text string? The result of evaluating the expression is a single number.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 26, 2007 at 5:53 am
3. No.
I displayed that BR contradicts itself in 900 cases out of 20000.
You're still lying. Let's see the post where you did that. Heck, I'll help you out.
Here is your test setup:
David, makea table, populate 1st column witn money numbers from 0.000 to 0.1999 step 0.0001.
This will cover both cases of Banker Rounding.
Populate 2nd column with bnRound result from Col1.
Count number of values rounded up (Col2 > Col1) and number of values rounded down (Col2 < Col1).
You'll see it's neither accurate nor fair.
This is the code I posted in response. You'll notice that it rounded up 9900 times, rounded down 9900 times, and didn't round at all 200 times, those 200 times being when the numbers ended in 2 zeros. You'll also note that the sum of the original values and the sum of the Banker's rounded values are the same, as are the averages. Neither of which is true for traditional rounding. Not only did your example make Banker's rounding look good, it exposed the bias caused by traditional rounding in some circumstances. Feel free to show these 900 cases you are referrring to, if you don't want to keep being called a liar.
DECLARE
@Money money
,@Step money
SELECT
@Money = 0.0000
,@Step = .0001
DECLARE @BRounding TABLE
(
Col1 money
,Col2 money
)
WHILE @Money < 2.000
BEGIN
INSERT INTO @BRounding
(
Col1
,Col2
)
VALUES
(
@Money
,dbo.fn_BRound(@Money, 100)
)
SET @Money = @Money + @Step
END
SELECT
RoundedDown = Count(*)
FROM
@BRounding
WHERE
Col1 > Col2
SELECT
RoundedUp = Count(*)
FROM
@BRounding
WHERE
Col1 < Col2
June 26, 2007 at 5:59 am
It's a number.
Its mathematical notation is 0.(3) .
Anybody who attended school knows that.
So, the question is still the same:
How you store 0.(3) in computer?
_____________
Code for TallyGenerator
June 26, 2007 at 6:03 am
Bring it on.
I just posted you one of those numbers where BR fails:
Value 0.1251 presented with different precisions is treated by BR differently.
In mathematics one example of failure is enough to disprove any theory.
_____________
Code for TallyGenerator
June 26, 2007 at 6:13 am
Nope, like 0.(3) it's NOT a number, it's a representation of a number. An expression.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 26, 2007 at 6:20 am
Any written set of signs is an expression of a number.
Can you show me a number, not a representation?
If to follow your logic, 1.0 is not a number as well, it's also a decimal representation of some number. Isn't it?
_____________
Code for TallyGenerator
June 26, 2007 at 6:29 am
You've finally got something right.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 26, 2007 at 6:33 am
June 26, 2007 at 7:27 am
Depends
could be
0x0000000003000000
or
0x0100000003000000
or
0x555555555555D53F
btw who's Davis ?
now you answer my question
Far away is close at hand in the images of elsewhere.
Anon.
June 26, 2007 at 7:29 am
Rarely. Really.
Here's another expression representing a number: "pair". It means 2. Like "one third" (or 1/3) it's a text expression, not a number, although it requires no evaluation.
Here's a handy example of usage: "As useful as a pair of tits on a bull". You may well be familiar with it, from evaluation.
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
June 26, 2007 at 9:59 am
Lies and the lying liars who tell them.
Your test scenario was coded as specified, and you were quite specific. BR nailed the results. Traditional rounding didn't. In your test, .1251 rounded to .13 with Banker's Rounding, as it should. If you're not able to figure out the WHERE clause, I'll happily modify the code for you, so you can see what it returns for .1251 based on your test setup. Again, that was your test. You're not moving the goalposts around the stadium, you're shipping them off to different countries. Stay focused, Giordy.
June 26, 2007 at 10:22 am
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.
Why would I care what precision it is? You said BR would not return 2 for that statement. I showed you that it did. End of story.
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.
No, just like any function, I need to provide BR with what I want it to work with. If I'm not able to give it the number I want, that's not a fault of BR. Again, no function works with some bizarre internal knowledge of what a number once was, they work with the values they receive, period. You can claim this all day long, but I can and have proven that not even your beloved Round() does this.
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.
You're not really the sharpest knife in the drawer, Giordy, and I don't really get frustrated when shooting fish in a barrel. Banker's Rounding is supposed to return a different result when the value it receives is .125 than when it receives .1251. They are different numbers as far as the function is concerned, as it only deals with what it receives, just like the Round() function (and every other function ever written in any programming language). Still has diddley and squat (your two best friends apparently) to do with the fact that BR nailed, and I do mean nailed, your test, and performed perfectly on the passed .1251 that your test outlined.
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.
Yes, the CPU works in binary, but for some funny reason, we've not only found ways of storing various numbers, including repeating ones, we even figured out how to store actual letters in memory. Some of us have advanced to where we can put those letters in certain orders and store words as well. The best and the brightest have actually stored entire paragraphs, and I've heard of someone storing a whole book in memory. Amazing! I'd tell you that we've even figured out how to store pictures in these magical "memory cells", but I don't want to blow your mind, so forget that I mentioned that.
I demonstrated a very straightforward method for storing repeating numbers which would work on about any computer out there.
Viewing 15 posts - 196 through 210 (of 378 total)
You must be logged in to reply to this topic. Login to reply