questionnable nint() behavior

Toon Moene moene@knmi.nl
Fri Mar 24 07:49:00 GMT 2006


Dominique Dhumieres wrote:

> Am I correct to understand
> the above as "violating parentheses is FORBIDEN by the standard"?  while
> bypassing the left to right evaluation is allowed, for instance computing
> A+B+C as A+(B+C) instead of (A+B)+C (say because B+C has already been computed)?

Yes (as Tobi already pointed out).  The rationale behind the rule is:

1. If the user specified a specific evaluation order by writing
    parentheses in the expression, honor it.

2. If the user didn't do this, you're free to find an efficient
    evaluation of the expression, provided such evaluation gives
    the same result when applied to the (mathematically) underlying
    number sets (i.e. Z for INTEGERs, R for REALs, etc.).

Hope this helps,

-- 
Toon Moene, KNMI, The Netherlands
Phone: +31 30 2206443; e-mail: moene@knmi.nl



More information about the Fortran mailing list