On 28/02/2011 07:08, IVP wrote: > Well, I really did think I had the operator precedence correct > > ( ) * / + - > > By "my" order > > (floor(2010 / 4)+2) is worked first =3D 504 I don't think so - if you look there is no bracket on the left of floor.=20 The middle part is: (2010 - 4 * floor(2010 / 4) + 2) So if you follow the order you do floor(year / 4) first =3D (2010 - 4 * 502 + 2) Then multiply first =3D (2010 - 2008 + 2) Then (to answer the bit below) addition and subtraction both have equal=20 precedence, so it is the sum of 2010 + (-2008) + 2 or just from left to right to get 4. > then 504 * 4 =3D 2016, then 2016 / 3 =3D 672 > > Your line > > 1 + ((2010 - 2008 + 2) / 3) =3D 1 + 4/3 > > by "my" order would give the result > > 1 + ((2010 - 2010)/3) =3D 1 + 0/3 > > because the ( ) outside 2010 - 2008 + 2 have precedence over /3 > >> > There is an example here: >> > http://williams.best.vwh.net/sunrise_sunset_example.htm > Thanks. That's helpful in seeing how the rules were bent (IMVHO) > to get the right answer I think (IMVVHO :-) ) it's actually right (I think you are taking=20 addition to have precedence over subtraction) but it wouldn't have hurt to put brackets in there to prevent any=20 ambiguity. Or a link to the example with some comments. > Harumph;-) > > Joe --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .