[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: kcalc math bug?



begin  Adam Majer  quotation:

> On Fri, Mar 29, 2002 at 10:00:20PM -0800, Craig Dickson wrote:
> > begin  Adam Majer  quotation:
> > 
> > > No!! There can't be an option. If a calculator does not follow
> > > precedence then there should be a grave bug against it. Why? Well, for
> > > starters, it would mean
> > >
> > > 2+3 != 3+2
> > 
> > Hardly. Ignoring precedence doesn't imply that addition isn't
> > commutative.
> 
> Well, try
> 
> 2+1*3
> 
> and 
> 
> 1*3+2
> 
> both are euqal to 5 by any basic math operations I know of.

Because you assume precedence is always used. That zinging noise you
just heard was a point zooming past your head.

> by your method it means

Don't call it my method, please. I didn't create it, and I wouldn't want
to use a calculator that worked that way. There are some people who
prefer it, though, and they have their reasons.

> 2+1*3 = 3*3 = 9
> 
> but
> 
> 1*3+2 = 3+2 = 5
> 
> but 9 != 5
> 
> 
> hence not obeying precedence makes 3+2 != 2+3

Not at all; it means the expression as a whole has a different value.
What you're doing here is taking two expressions that are equal only if
standard precedence rules are used, and observing that they are not
equal if those rules are ignored (which is rather obvious). You say that
3+2 != 2+3, yet 2+3 appears nowhere in your two examples; 2+1*3 != 2+3
if you evaluate strictly left-to-right, as your own example shows. So
your examples don't say what you think they do; they certainly don't
demonstrate a violation of the commutativity of addition.

Interestingly, in reference to your previous claim that ignoring
precedence would mean that the set of floating point numbers is not a
field (IIRC), the formal definition of "field" and the related terms
"ring" and "division ring" do not require or imply precedence. Here
you go:

    http://planetmath.org/?op=getobj&from=objects&name=Ring
    http://planetmath.org/?op=getobj&from=objects&name=DivisionRing
    http://planetmath.org/?op=getobj&from=objects&name=Field

Precedence is really just a notational convention, and definitions of
fundamental mathematical concepts shouldn't be dependent on such things.
(This is why carefully-written mathematical definitions, such as the
above examples, explicitly parenthesize expressions.)

> PS. This is just one example that shows why any calculator 
> not using precendence is crap.

No, it's an example of you refusing to understand why some people (not
me) with specific needs might want them to work that way. Some people,
particularly bookkeepers, like to keep running totals as they calculate,
without having to hit = after every number (which is inconvenient if you
have to do it all the time). This is incompatible with arithmetic
precedence.

I would be appalled to see an infix-notation scientific calculator that
did not obey precedence. However, for a simple four-function model, for
the purposes such calculators are often used for (e.g. bookkeeping), it
makes sense. This is not a statement of mathematical theory, but of
practical usage, a distinction which you seem to be having trouble
making.

Craig

Attachment: pgpa9_Gm2BymB.pgp
Description: PGP signature


Reply to: