Re: Code as documentation



On Jan 23, 2:49 pm, glen herrmannsfeldt <g...@xxxxxxxxxxxxxxxx> wrote:
mecej4 wrote:
Paul van Delst wrote:

(snip)

So ... X/Y*Z is looked upon with disfavour?
This case is confusing because the Fortran meaning differs from that in
a mathematical text. In algebra, the convention is that a/bc means
<Fortran> a/(b*c) </Fortran>, as opposed to <Fortran> a*c/b) </Fortran>

As far as I know, a/bc in algebra means (a/b)*c, but in a
book you can write:

   a
-----
  b c

which means a/(b*c).  You can't do that in Fortran.

I am not so sure that the current algebraic precedence wasn't
borrowed back from Fortran, though.

-- glen

http://en.wikipedia.org/wiki/Order_of_operations

I say we just follow this as closely as possible where possible and
where not, define explicitly the rule and reason for the exception.
.



Relevant Pages