Closed Thread Icon

Preserved Topic: Order of precedence? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=17190" title="Pages that link to Preserved Topic: Order of precedence? (Page 1 of 1)" rel="nofollow" >Preserved Topic: Order of precedence? <span class="small">(Page 1 of 1)</span>\

 
Lord_Fukutoku
Paranoid (IV) Inmate

From: West Texas
Insane since: Jul 2002

posted posted 10-05-2002 00:03

All right, got a question for all you people in Discrete Math, or a high level math class, or if you've taken one of them before.

In my Math Reasoning class, we were taught this way:
--Highest precedence--
1. Negation
2. And / Or
3. Implies
4. Iff
--Lowest precedence--

However, in Discrete Math, we are being taught this way:
--Highest precedence--
1. Negation
2. And
3. Or
4. Implies / Iff
--Lowest precedence--

There's enough difference there to get at least a few wrong answers on quizzes/tests, and, well, it's kinda hard to keep a 3.5GPA when your profs don't even agree on things...

I happen to agree with my prof in Math Reasoning (and the book), mainly because nowhere in my Discrete book does it give the order of precedence. Nor does it even imply that the Implies and Iff ops are done right to left rather than the Implies' then the Iff's.

If anyone has a book that specifically gives the order, could you post what it says, and possibly the title of the book.

Math Reasoning: Introduction to Advanced Mathematics by Barnier and Feldman
Discrete: At the house, so I'll edit this when I get home.


Most of the sites (here and here are 2) I've found say:
1. Negation
2. And
3. Or
4. Xor
4. Iff (equivilent)
5. Implies

However, I found one for FORTRAN:
1. And
2. Or
3. Not eqv
4. Xor
5. Eqv
6. Negation

Then there's this one with:
1. Negation
2. And
3. Or
4. Xor
5. Implies
6. Eqv
7. Universal quantifier
8. Existential quantifier

[edit: So far, my vote goes for this last one...]


Is every language independent with regards to this? Even then, Discrete Math and Math Reasoning you'd think would be the same...


________________________________________________________________
-- Jack of all trades, master of that which has my attention at
the moment.

Unoriginal Cell 693

[This message has been edited by Lord_Fukutoku (edited 10-05-2002).]

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 10-05-2002 02:34

Umm I'm not a math guy and never was.

But how the way Microsoft chose to do operator precedence in VBScript or the way the orginal IBM FORTRAN developers chose to do theres mean one is correct? These are just the ways those compilers interpret code not necessarily which is mathmatically correct.



.:[ Never resist a perfect moment ]:.

synax
Maniac (V) Inmate

From: Cell 666
Insane since: Mar 2002

posted posted 10-05-2002 04:06

If it helps, my discrete book uses this precedence:
1. Negation
2. And/or
3. Implies/Biconditional

Lord_Fukutoku
Paranoid (IV) Inmate

From: West Texas
Insane since: Jul 2002

posted posted 10-05-2002 04:24

bit - yea, after a bunch of looking, it looks like the languages vary at least a little bit in their operator precedence, but Discrete isn't a language specific course, and unlike several courses, math isn't really open to interpretation.

I'm really just trying to avoid having to learn it two different ways at the same time, then having to remember which is which on the tests.

synax - Thanks. Somehow, I get the feeling that every Discrete book is going to have a different order now...

________________________________________________________________
-- Jack of all trades, master of that which has my attention at
the moment.

Unoriginal Cell 693

silence
Maniac (V) Inmate

From: soon to be "the land down under"
Insane since: Jan 2001

posted posted 10-05-2002 06:18

It's just a matter of semantics and how each discipline decides to order precedence. For that, you'll just have to memorize it and try to keep it straight in your head.

As far as programming goes, each language follows the same basic precedence order, with some exceptions:

1. Negation
2. And
3. Or
4. Implies
5. Iff

Now, some may decide to group And and Or at the same precedence order. It all depends, and you just have to find some way to remember them. Granted, they're very similar so you should be alright if you remember the basic set.

I just want to stress that precedence is EXTREMELY important in programming. You'll have a definite advantage if you have your operator precedence down. You'll be able to decipher crap like this:

int* Switch_With_Function_Pointer(float **a[][], float b, float (*pt2Func)(float, float));

My discrete prof. was a genius at this stuff, and this was actually one of our test questions. If you wanna know, the above is a function that takes as its paramaters a pointer to a pointer to a pointer to a 2D array of floats, a float, a pointer to a function that takes as its parameters 2 floats and returns a float, and returns an int pointer.

Whew. hehe


« BackwardsOnwards »

Show Forum Drop Down Menu