questionnable nint() behavior
Tim Prince
tprince@myrealbox.com
Thu Mar 23 14:06:00 GMT 2006
Dominique Dhumieres wrote:
> Tim,
>
> Thanks for the answer and tips.
>
>
>>If ifc means an old Intel linux compiler
>
>
> version 8.1
>
>
>>the option for strict observance of parentheses (other than -O0)
>>was -mp.
>
>
> As far as I can tell ifc replace (f+a)-f by a with any option
> I am using.
>
>
>>In future versions of ifort, a better targeted option for that purpose
>>is '-fp-model precise'.
>
>
> Does not work with the version I am using.
>
>
>>One might make a case for choosing the set of options closest
>>to consistency with gfortran, when making comparisons.
>
>
> First a general comment: istead of putting the blame on the user,
> the different designers should be encouraged to avoid esoteric
> flags for basic options and to do their best to use common syntax.
>
> Secondly, this is the first time I realized that a compiler can
> ignore the parentheses I put. I naively though it was mandatory
> to obey them. I think this is a wrong user model: not only is he
> stupid enough to write f+a-f, but he adds masochism to stupidity
> by putting useless parentheses! Now what happens with
> a0+x*(a1+x*(a2+...))
> (Hoffner algorithm if my memory is not too bad)? Would the compiler
> be allowed to rewrite it a0+a1*x+a2*x**2+... ?
>
> Note that xlf obeys the parenthese up to -O2.
>
Compilers which substitute K&R C rules on association for ISO language
standard rules still obey algebraic rules, so will not affect the
working of Horner's rule. I am fully in agreement that the long
standing gcc rules, where even -ffast-math falls short of violating
parentheses, are better from a usability point of view. I've heard of
discussion among the SPEC benchmark people, some of whom regret the
pressure they have put on compiler vendors to make risky options a
default, or link them to optimization level.
More information about the Fortran
mailing list