(j3.2006) Asymmetry of REAL, CMPLX intrinsics

Bill Long longb
Mon Jan 7 18:04:15 EST 2008


This seems like a recurring discussion. 

REAL is really two different functions. One is type conversion that 
converts the argument to type real.  The other extracts the real part of 
a complex value.  As is the case for the companion AIMAG, this is not is 
not a type conversion.   CMPLX, on the other hand, is only a type 
conversion function.  I think the type conversion operations should have 
similar rules, as is the case now.  The use of REAL as an extraction 
operation for complex arguments is sort of an oddball case that is 
reasonably treated differently.  I don't see the motivation for changing 
this treatment, especially since it introduces a backward 
incompatibility.  Maybe we could modify the Description of REAL to be 
"Convert to type real or extract the real part of a complex value."

Cheers,
Bill


Van Snyder wrote:
> If the argument of REAL is real and the KIND argument is not present,
> the result kind is default real.
>
> If the argument of REAL is complex and the KIND argument is not present
> the result kind is the kind of the argument.
>
> If the KIND argument of CMPLX is not present, the result kind is the
> same as default real kind, no matter whether the X argument is real or
> complex.
>
> For symmetry, it would be helpful if the result kind of CMPLX were the
> same as the X argument kind, if the X argument is real, and default real
> kind if the X argument is complex.
>
> It is probably too late to change this in 2008 (although I may submit a
> comment).
>
> Are you in favor of the change at some unspecified time, or do you
> object to the change no matter when it's attempted?
>
>   

-- 
Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120

            




More information about the J3 mailing list