Re: This calculation is just wrong / computer can't count!
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Tue, 09 Oct 2007 21:18:37 -0400
And "accurate" can ONLY be discussed in terms of a binary 52-bit mantissa. Talking about
text as if it is "accurate" is meaningless. Text is just text. The ONLY reality is a
64-bit IEEE-754 floating point representation, which is accurate to ±1/2LSB. Because you
labor under a delusional system in which you think decimal numbers have meaning to a
computer, you remain eternally confused.
Here is the heart of your failure to understand:
0.83333333333333337 is not correct / accurate, but is precise to 17 decimal
places.
Sorry. 0.83333333333333337 is correct, accurate, and in fact is accurate to 1 part in
2**52. Any other representation and any interpretation in any other representation is
meaningless to the computer. Just because it doesn't conform to decimal arithmetic is no
reason to say it is not correct or not accurate! You just don't get it. Binary
arithmetic is not decimal arithmetic
There are only 10 kinds of people in the world. Those who understand binary, and those
who don't.
If you get that, then you should understand what everyone has been telling you for days.
Computers do not use decimal arithmetic, not even for integers! The only difference is
that for some ranges of integers, the transformation is not information-losing. Please
explain what is wrong with this statement:
DWORD value = strtoul("12345678901", NULL, 10);
Same issue, EXACTLY the same issue.
joe
On Tue, 9 Oct 2007 17:19:36 +0100, "GT" <ContactGT_remove_@xxxxxxxxxxx> wrote:
"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in messageJoseph M. Newcomer [MVP]
news:qa3ng316jmu1mirddnkejp9nbkg2oj1nfq@xxxxxxxxxx
What part of "you can't get it" are you not getting? You cannot get
0.8333333333333333.
because that is fewer bits of precision than an FPU implements. You
cannot get
0.83333333333333333 because it has no representation in floating point.
You have been told repeatedly that if you want to see the value
0.8333333333333333 then
print out fewer decimal places when you display it. This question was
answered many,
many, many times. If you type the value 0.8333333333333333 into your
computer, and
convert it to floating point, you get the value 0.83333333333333326. This
is less
accurate as a representation of 25/30 than 0.83333333333333333 for reasons
several of us
have explained to you.
Note that if you use textual representations then the following holds
double d = 25./30.; // 0.83333333333333337
CString s;
s.Format(_T("%.16f"), d); // 0.8333333333333333
double d2 = atof(s); // 0.83333333333333326
then
d != d2
because d has the value 0.83333333333333337 and d2 has the value
0.83333333333333326, so
your "more accurate" value is actually less accurate because it differs
from the
approximate, but incorrect, decimal value 0.83333333333333333 by a larger
amount.
Consequently, the "wrong" value is more "right", and this is what we've
all been trying to
explain to you!
You are mixing your terms again. Accurate means the number is correct,
precise refers to the number of decimal places.
0.83 is correct / accurate and precise to 2 decimal places.
0.8333333333333333 is not incorrect as you say, but is correct / accurate
and precise to 16 decimal places.
0.83333333333333337 is not correct / accurate, but is precise to 17 decimal
places.
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- Follow-Ups:
- References:
- Re: This calculation is just wrong / computer can't count!
- From: .rhavin grobert
- Re: This calculation is just wrong / computer can't count!
- From: GT
- Re: This calculation is just wrong / computer can't count!
- From: Joseph M . Newcomer
- Re: This calculation is just wrong / computer can't count!
- From: GT
- Re: This calculation is just wrong / computer can't count!
- From: Joseph M . Newcomer
- Re: This calculation is just wrong / computer can't count!
- From: GT
- Re: This calculation is just wrong / computer can't count!
- From: Joseph M . Newcomer
- Re: This calculation is just wrong / computer can't count!
- From: GT
- Re: This calculation is just wrong / computer can't count!
- From: Joseph M . Newcomer
- Re: This calculation is just wrong / computer can't count!
- From: GT
- Re: This calculation is just wrong / computer can't count!
- Prev by Date: Re: This calculation is just wrong / computer can't count!
- Next by Date: Re: This calculation is just wrong / computer can't count!
- Previous by thread: Re: This calculation is just wrong / computer can't count!
- Next by thread: Re: This calculation is just wrong / computer can't count!
- Index(es):
Relevant Pages
|