help-octave
[Top][All Lists]
Advanced

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

Re: Maidir le: Octave and Please Excuse My Dear Aunt Sally


From: John Swensen
Subject: Re: Maidir le: Octave and Please Excuse My Dear Aunt Sally
Date: Mon, 30 May 2011 09:41:48 -0400

The expansion of PEDMAS is
"Parentheses, Exponents, Multiplication and Division, and Addition and 
Subtraction".
The "and" for both DM and AS implies they are of equal precedence and therefore 
it is still correct.  I guess the left to right for equal precedence is implied.

John Swensen

On May 30, 2011, at 6:03 AM, OCuanachain, Oisin (Oisin) wrote:

> Apparently you went to a school using poor textbooks:
> http://en.wikipedia.org/wiki/PEMDAS#Mnemonics
> I had never heard of PEDMAS before but the above article makes it clear that 
> M and D have equal precedence, as do A and S, with operations of equal 
> precedence being evaluated from left to right. Thus Octave's behaviour is 
> correct even according to this 'PEDMAS' scheme, you were just taught it 
> incorrectly. Guess you'd better rewrite your code, and reprimand your former 
> maths teachers.
> 
> 
> -----Bunteachtaireacht-----
> From: address@hidden [mailto:address@hidden Thar ceann clustro
> Sent: 27 Bealtaine 2011 19:05
> To: address@hidden
> Subject: Octave and Please Excuse My Dear Aunt Sally
> 
> Hello everyone,
> 
> I tried doing this operation as a test:
> 
> 3*4/2*2
> 
> Following PEMDAS (Please Excuse My Dear Aunt Sally), I should get:
> 
> 3*4 = 12
> 
> 2*2 = 4
> 
> 12/4 = 3
> 
> But instead, I get 12, because apparently octave is doing 4/2 first, and
> then multiplication.
> 
> What on earth is octave doing? Apparently, I am not the only person who
> thought Octave used PEMDAS (http://tinyurl.com/3rfsk9g, last page). What
> order of operations is octave using?
> 
> This might seem like such a slight matter but there is a bunch of code I
> have to go back and fix now because of this, and I just want to make sure I
> know the correct priority of the operations to save myself having to do it
> all over again.
> 
> Thanks,
> 
> -Brad Ridder
> 
> --
> View this message in context: 
> http://octave.1599824.n4.nabble.com/Octave-and-Please-Excuse-My-Dear-Aunt-Sally-tp3555977p3555977.html
> Sent from the Octave - General mailing list archive at Nabble.com.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave



reply via email to

[Prev in Thread] Current Thread [Next in Thread]