Re: Standards question regarding intrinsics with complex arguments
- From: nospam@xxxxxxxxxxxxx (Richard Maine)
- Date: Mon, 30 Jun 2008 10:49:02 -0700
Paul van Delst <Paul.vanDelst@xxxxxxxx> wrote:
I believe the code in question is standard Fortran95 and that the compiler[also cites the intrinsic descriptions from the standard]
is incorrect in producing these warnings. Section 4.3.1.3 (Complex Types)
of the Fortran95 standard states:
"Each approximation method used to represent data entities of
type real shall be available for both the real and imaginary
parts of a data entity of type complex....
An IBM person has since told me that:
<quote>
...I suspect the standard does not require an implementation to support
any precision in complex intrinsic functions other than the default.
Therefore aimag(z) is only standards compliant if z is a default precision
complex number.
</quote>
That is just plain wrong. There isn't any defensible basis for it. You
have the relevant citations already. At the least, since the standard
requires supporty of double precision real, the citations you found also
require support of double precision complex, including all the relevant
intrinsics. For double precision, there just is no "out".
I have heard vendors attempt to "wiggle" out of the requirement for
precisions other than single and double. I regard the attempts as
flawed, but at least they come a lot closer than the above argument. The
above just sounds like someone remembered that there was some argument
to use, but forgot what the argument was and tried to guess one on the
spot. Wrong guess, though.
The only argument that comes even close to holding water is to claim
that the vendor's support of real precisions other than single and
double is an extension of the standard rather than being an
implementation of another standard-conforming kind. That argument
doesn't really hold up, but it at least sounds plausible on the surface.
The reason it doesn't really hold up is because I'd bet good money that
all the vendors that claim that argument don't implement it the way that
they would have to in order to make that argument valid. They would need
to do more than just leave out random things like some intrinsics.
For example, if the vendor claims that a particular real kind is some
extension instead of one of the kinds mentioned in the standard, then
selected_real_kind had better not ever return that kind. Having
selected_real_kind return something that is not a valid,
standard-conforming kind (or one of the negative failure codes) is a
*VIOLATION* of the standard - not an extension. That's a critical
distinction. If selected_real_kind returns a non-negative value, then
that value has to be useable as a kind value for complex, and all the
appropriate intrinsics have to work with it. There are a bunch of other
simillar things, but that's the simplest one that occurs to me.
And to repeat, none of this applies to single and double precision at
all. The standard just requires those. Period. To the extent that the
vendor rep claimed that the standard required support only for default
precision, he is just wrong. He has to at least add in double precision
to make the claim plausible. I don't think the claim is strictly
defensible even for quad precision, by arguments like the one I gave
above, but that at least requires some subtlety in the argument.
P.S. 15 is close enough to the boundary that I'm not 100% sure whether
you are getting double precision or a quad precision here. The comments
imply double, which would make the results indefensible, according to
me. But comments aren't "normative". If you happen to be getting quad,
then there are at least grounds for a standard conformance warning
somewhere, though I'd think the intrinsics the wrong place for it.
--
Richard Maine | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle | -- Mark Twain
.
- Follow-Ups:
- Re: Standards question regarding intrinsics with complex arguments
- From: Paul van Delst
- Re: Standards question regarding intrinsics with complex arguments
- References:
- Standards question regarding intrinsics with complex arguments
- From: Paul van Delst
- Standards question regarding intrinsics with complex arguments
- Prev by Date: Re: including cray pointers in fortran modules
- Next by Date: Re: PGI wierdness with .EQV.
- Previous by thread: Standards question regarding intrinsics with complex arguments
- Next by thread: Re: Standards question regarding intrinsics with complex arguments
- Index(es):
Relevant Pages
|