Re: This calculation is just wrong / computer can't count!



Your fundamental point: that you want the computer to produce the answer you think you
want, instead of the answer it is capable of producing, is what is the discussion here.
You will not get the answer you want; you will get the correct answer; alas, you seem to
think the correct answer is wrong.

The other problem is that you think you are trying to work at a level "above binary
conversions", and unfortunately for you, this is impossible, since the only representation
we have is the binary representation of the computer. You cannot dissociate your
conceptual model from reality as you wish to do. If you want the answer you get with
pencil and paper, I suggest that you use pencil and paper, because 'double' is not going
to do it for you.

It has already been pointed out several times that the only way you can deal with this is
to use rational arithmetic, in which all operations are done symbolically, and to get the
correct and accurate representation you must ultimately print out the numerator and
denominator. Any other representation printed out risks producing an incorrect answer,
and we know you don't want that. But to insist beyond reason that the computer cater to
your delusional system of mathematics, one based on a decimal arithmetic model, is
nonsensical. We have understood the question for days; what you have not understood is
that there is no answer as long as you use 'float' and 'double'. You cannot use BIGNUM.
The best you can hope for is to use rational arithmetic and use BIGNUM representations of
the numerator and denominator (64 bits might be insufficient). You can read all about how
to do this in elementary texts like Don Knuth's books, or the Numerical Recipes book.

But if you keep insisting that 'double' is supposed to do something that is impossible for
it to do, for which it was never designed, and continue to confuse representational
issues, there's nothing to discuss.

By the way, you have not yet BEGUN to understand the implications of roundoff and fixed
precision. You need a good course in numerical analysis methods for computers before you
even have a glimmer of how superficial your concerns are. The REAL concerns are much
deeper, and at no time in the history of floating point has it EVER been possible to
"ignore" any aspect of floating point precision.

Had your question been "how can I get accurate results" instead of whining about how you
think floating point doesn't work right (it works right, and all your opinions to the
contrary are irrelevant), then the answer would have been simple: use rational arithmetic
with BIGNUMs. No other answer will be possible. But you took the issue that you didn't
like the values you got, thought they were wrong, insisted that floating point arithmetic
conform to your world view, etc., and the result is that you got dumped on by me and
everyone else. The correct statement would be:

"I do not wish to deal with the inherent inaccuracy of double precision floating point. Is
there a means other than double precision floating point of doing computer arithmetic
which preserves all digits of accuracy" and the answer, which I and others have known
since the early 1970s, would be "rational arithmetic". But instead, you kept focusing on
why double didn't work right, and double DOES work right, but not in your system of
mathematics. ONLY rational arithmetic can possibly work. You can safely assume that for
most computations you will never be able to represent the result correctly with a finite
set of digits, and therefore, all displays will inherently round or truncate, and such
rounding or trunction will always introduce errors. Thus, you could never type in
0.3333333 to ANY length and get the same value as 1/3. Ever. 1/3 is the rational pair
<1,3>, nothing more. But instead, you whine about precision and accuracy as if you have a
clue as to what you are talking about, and you don't. Not as long as you use double
precision floating point.
joe

On Tue, 9 Oct 2007 17:18:38 +0100, "GT" <ContactGT_remove_@xxxxxxxxxxx> wrote:

"Joseph M. Newcomer" <newcomer@xxxxxxxxxxxx> wrote in message
news:c92ng3d6hod5pe0srg7vev89rhginavg60@xxxxxxxxxx
One last chance:

1/3 is not 0.333333333333 in a computer. It is

0.33333333333333331

and 10/3 = 3.3333333333333335

Joe, this is the point that YOU are missing: I fully understand how the
computer stores this information and I utterly don't care. I work at a level
above binary conversions, machine code and numeric word storage. I want to
program some mathematics functions that return the correct answer according
to the basic decimal mathematics that I am doing on paper.

and if you had more than two functioning neurons you would recognize that
your fixation on
decimal arithmetic is the fundamental failure here; you are trying to talk
about binary
arithmetic as if it is decimal arithmetic, and that makes no sense.

No, you are trying to explain something in binary mathematics that we have
covered many many times and is not the question and is not relevant!

I agree with Les; at this point, a career change is going to be more
productive. I hadn't
gone that far, but you are missing EVERY SINGLE POINT WE HAVE BEEN TRYING
TO MAKE while
insisting your world view makes sense. It makes sense only in decimal
artihmetic, and
WHAT PART OF "COMPUTERS USE BINARY ARITHMETIC" ARE YOU MISSING?

Please feel free to change career, perhaps you could take up politics - they
are very good at ignoring the question and answering another question that
they prepared beforehand!

No, I have read and absorbed the *single* point you have made over and over
and over again. Everytime you have made the point I have replied to say that
we all understand that a computer is a binary machine and the mathematics I
am trying to do is decimal based. I then go on to ask the same question over
and over and over again and your 2 neurons seem to just miss the question
and reply with the same explanation of WHY we are seing these numbers,
rather than how we write code that conforms to decimal, simple, straight
forward mathematics.

Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: bits for floating value and converting
    ... precision floating point Representation" and normal floating number? ... recognize that result as being IEEE 754 single precision representation. ...
    (comp.lang.c)
  • Re: How do you keep track of what all the numbers mean?
    ... that if you develop a floating point representation of a system, ... but I would suspect that scaling constants is a main part of it. ... There will be an assumed scaling between the floating point ... will depend upon the input signal power. ...
    (comp.dsp)
  • Re: Rounding of the double
    ... John von Neumann suggested that only fixed-point integers should be used because floating ... If you choose your representation as double, then you have to live with the consequences. ... you can never get precision in any computation on a computer than involves ... MVP Tips:http://www.flounder.com/mvp_tips.htm- Hide quoted text - ...
    (microsoft.public.vc.mfc)
  • Re: This calculation is just wrong / computer cant count!
    ... There is no 7 at the end of a decimal representation of ... mathematicians insisted that mathematics could be a closed ... insisting that it MUST be achieved. ... You may not care, but SOMEONE ...
    (microsoft.public.vc.mfc)
  • Re: How do you keep track of what all the numbers mean?
    ... that if you develop a floating point representation of a system, ... but I would suspect that scaling constants is a main part of it. ... There will be an assumed scaling between the floating point ... So, in my LMS equalizer example, if my floating point equalizer input ...
    (comp.dsp)