>On 02/01/2016 14:29, Cedron wrote: > >> Nope, didn't learn it that way in school. Never even heard of it.For>> C/C++, and every other compiler I know about it is incorrect too. >> >Perhaps you're a foreigner and it was called PEMDAS. >Or perhaps I'm older and it wasn't introduced yet.>> >> Note that division does not take precedence over multiplication. > >I never said it did. >The way you listed it implies you did.>You do the division before the multiplication here because you evaluate >left to right.Your list clearly says division is ahead of multiplication. From reading your list, how is someone supposed to understand division is not ahead of multiplication, but multiplication is ahead of addition? Ced --------------------------------------- Posted through http://www.DSPRelated.com
This has been doing teh rounds
Started by ●January 1, 2016
Reply by ●January 2, 20162016-01-02
Reply by ●January 2, 20162016-01-02
On 02/01/2016 15:12, Cedron wrote:> Your list clearly says division is ahead of multiplication. From reading > your list, how is someone supposed to understand division is not ahead of > multiplication, but multiplication is ahead of addition?Perhaps it needs brackets around the terms? :-)
Reply by ●January 2, 20162016-01-02
On Saturday, January 2, 2016 at 11:09:01 PM UTC+13, mm0fmf wrote:> On 02/01/2016 02:41, gyansorova@gmail.com wrote: > > I have this down for 1 since the brackets and the multiply comes first. > > Did't you learn BODMAS in school for operator precedence? > > Brackets > Of > Division > Multiplication > Addition > Subtraction > > So applying BODMAS, remeber it goes left to right, to 6 - 2(1+2) gives > > 6 / 2 * (1 + 2) > > evaluate brackets > > 6 / 2 * 3 > > evaluate division > > 3 * 3 > > evaluate multiplication > > 9If I write an equation d-abc where - is divide. I take that to be (d/abc) and stuff Bodmas! If you don't use brackets it is simply ambiguous.
Reply by ●January 2, 20162016-01-02
> >d-abc > >where - is divide. I take that to be (d/abc) and stuff Bodmas! If youdon't>use brackets it is simply ambiguous.Not ambiguous, perhaps misleading, poor practice, etc. d/abc = (d/a)bc not d/(abc) If you want the latter, you can also write d --- abc Despite your admirable renegade proclamation, conventions can be useful. Personally though, I prefer labels (e.g. Order of Precedence) over mnemonics (e.g BODMAS). Is that part of common core? Ced --------------------------------------- Posted through http://www.DSPRelated.com
Reply by ●January 2, 20162016-01-02
On Sunday, January 3, 2016 at 9:35:17 AM UTC+13, Cedron wrote:> > > >d-abc > > > >where - is divide. I take that to be (d/abc) and stuff Bodmas! If you > don't > >use brackets it is simply ambiguous. > > Not ambiguous, perhaps misleading, poor practice, etc. > > d/abc = (d/a)bc not d/(abc) > > If you want the latter, you can also write > > d > --- > abc > > Despite your admirable renegade proclamation, conventions can be useful. > Personally though, I prefer labels (e.g. Order of Precedence) over > mnemonics (e.g BODMAS). Is that part of common core? > > Ced > --------------------------------------- > Posted through http://www.DSPRelated.comWell this is a bit hypothetical anyway I suppose but are you saying that if I wrote a formula as d-abc where - is divide that people woudl interpret that as (d/a)bc? I don't think they would but however as we all know the divide symbol is rarely if ever used outside of primary school anyway and if you write d/abc when you mean (d/a)bc you are asking for trouble.
Reply by ●January 2, 20162016-01-02
> >Well this is a bit hypothetical anyway I suppose but are you saying thatif>I wrote a formula as > >d-abc where - is divide that people woudl interpret that as (d/a)bc? >What people would do is a mystery, but what they should do is precisely that. You are implying that an implied multiple has (or should have) a higher order of precedence than division. d ÷ abc d ÷ (a*b*c) See, it can be done.>I don't think they would but however as we all know the divide symbol is >rarely if ever used outside of primary school anyway and if you writed/abc>when you mean (d/a)bc you are asking for trouble.If you mean (d/a)bc you will be fine, especially to a compiler. If you want d/(abc), you need to include the parenthesis for a compiler, or you are asking for trouble. When I am coding, I would write bcd/a if I wanted (d/a)bc. The main reason being the behavior of integers I pointed out earlier. However, if the situation might overflow then I would leave it (d/a)bc rather than d/abc just for the sake of clarity. Ced --------------------------------------- Posted through http://www.DSPRelated.com
Reply by ●January 2, 20162016-01-02
> >d ÷ abc > >d ÷ (a*b*c) > >See, it can be done. >Funny it worked in the editor. New test: d ÷ abc Ced --------------------------------------- Posted through http://www.DSPRelated.com
Reply by ●January 2, 20162016-01-02
On Sunday, January 3, 2016 at 11:23:19 AM UTC+13, Cedron wrote:> > > >Well this is a bit hypothetical anyway I suppose but are you saying that > if > >I wrote a formula as > > > >d-abc where - is divide that people woudl interpret that as (d/a)bc? > > > > What people would do is a mystery, but what they should do is precisely > that. You are implying that an implied multiple has (or should have) a > higher order of precedence than division. > > d � abc > > d � (a*b*c) > > See, it can be done. > > >I don't think they would but however as we all know the divide symbol is > >rarely if ever used outside of primary school anyway and if you write > d/abc > >when you mean (d/a)bc you are asking for trouble. > > If you mean (d/a)bc you will be fine, especially to a compiler. If you > want d/(abc), you need to include the parenthesis for a compiler, or you > are asking for trouble. > > When I am coding, I would write bcd/a if I wanted (d/a)bc. The main > reason being the behavior of integers I pointed out earlier. However, if > the situation might overflow then I would leave it (d/a)bc rather than > d/abc just for the sake of clarity. > > Ced > --------------------------------------- > Posted through http://www.DSPRelated.comI am saying that for the first case you should always write (d � a)bc if you have to use the infernal sign at all.






