(j3.2006) Asymmetry of REAL, CMPLX
Bill Long
longb
Mon Jan 7 19:38:02 EST 2008
Van Snyder wrote:
> Assuming no KIND argument...
>
> Where REAL has a real, integer or BOZ argument, its result kind is
> default real.
>
This is type conversion.
> Where REAL has a complex argument, its result kind is the same as the
> argument.
>
This is not type conversion - just component extraction.
> Where CMPLX has a complex, integer or BOZ argument, its result kind is
> default real.
>
Type conversion again.
> Where CMPLX has a real argument, its result kind is still default real,
>
Also type conversion. Consistent with all the other cases above.
> NOT the same as the argument. This is the one that's singled out for
> unexpected behavior, and shouldn't be.
>
I guess it is not unexpected to me.
> REAL <=> COMPLEX ought to work consistently, not REAL => COMPLEX working
> one way, and COMPLEX => REAL working differently.
>
But they are different animals. Why should they work the same?
> Dan has pointed out that there have been other proposals for a new
> intrinsic, spelt COMPLEX e.g., that would provide symmetry. That's just
> sugar for CMPLX with a KIND argument;
What is the KIND of the result of these:
COMPLEX(1,0)
COMPLEX(1., 0.d0)
COMPLEX(1.,0)
I think this is also likely to be confusing.
Cheers,
Bill
> it doesn't solve the real problem,
> which is the surprising asymmetry that costs time, money and
> reliability.
>
>
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3
>
--
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