However, REAL(c) with c complex returns the real value of c with the
kind of c. Thus if c is double precision complex, real returns a double
precision real. Thus it seems not unreasonable to expect CMPLX(x, y) to
return a complex with the kind of x.
Admittedly, this might break some programs.
Cheers, Wes
On Fri, 2017-06-02 at 15:48 +-0000, Bill Long wrote:
+AD4 Maybe I missed something in the noise here, but I+IBk-m having trouble seeing the issue.
+AD4
+AD4 The desire to make CMPLX generic is moot. CMPLX is already generic. It will accept arguments that are complex, real, integer, or even boz constants.
+AD4
+AD4 The KEY point is that CMPLX is a type conversion function. Just like REAL. If I code REAL(x) I expect the result to be default REAL with the value of x, as close as conversion allows. In other words, convert X to type default REAL. If I code REAL(x, 8) then I expect the result to be REAL with KIND+AD0-8. Same pattern for INT. And for CMPLX.
+AD4
+AD4 The argument for a compiler option to change the interpretation of CMPX to something else that is incompatible with the standard seems equivalent to +IBw-I didn+IBk-t pay attention in my programming class, or had a bad teacher/textbook, and I don+IBk-t want to learn real Fortran but rather what to keep making my old mistakes over and over again+IB0. It seems a request like that would get little interest from a compiler vendor.
+AD4
+AD4 But the discussion does raise the point that better teaching of Fortran programming and maybe more/better textbooks might be a good idea.
+AD4
+AD4 Cheers,
+AD4 Bill
+AD4
+AD4
+AD4
+AD4 +AD4 On Jun 2, 2017, at 3:43 AM, Robin Vowels +ADw-robin51+AEA-DODO.COM.AU+AD4 wrote:
+AD4 +AD4
+AD4 +AD4 From: +ACI-Malcolm Cohen+ACI +ADw-malcolm+AEA-NAG-J.CO.JP+AD4
+AD4 +AD4 Sent: Friday, June 02, 2017 6:30 PM
+AD4 +AD4
+AD4 +AD4
+AD4 +AD4APg +AD4-The proposal does not invalidate any old programs.
+AD4 +AD4APg Unfortunately it does, it invalidates programs going all the way back to
+AD4 +AD4APg Fortran 77.
+AD4 +AD4
+AD4 +AD4 You didn't read my proposal.
+AD4 +AD4
+AD4 +AD4 I wrote :--
+AD4 +AD4 Compatabilty with the old non-generic form, dating from the 1960s,
+AD4 +AD4 can be provided by a compiler option.
+AD4 +AD4
+AD4 +AD4APgA+ And some users could well find that their programs begin giving
+AD4 +AD4APg more-accurate results +ACEAIQ because they did not use CMPLX correctly (and
+AD4 +AD4APg inadvertently had their double-precision values quietly converted to single
+AD4 +AD4APg precision).
+AD4 +AD4APg And other users could well find their programs failing to compile, giving
+AD4 +AD4APg incorrect results,
+AD4 +AD4
+AD4 +AD4 Not with a compiler option.
+AD4 +AD4
+AD4 +AD4APg or crashing at runtime because they are now passing
+AD4 +AD4APg things twice as big as before, but the receiver is not expecting that.
+AD4 +AD4
+AD4 +AD4 Not with a compiler option.
+AD4 +AD4
+AD4 +AD4APgA+ The inadequacy of the existing CMPLX has caught professionals.
+AD4 +AD4
+AD4 +AD4 And that's precisely the reason for making the change.
+AD4 +AD4
+AD4 +AD4APg Which is precisely why I wrote:
+AD4 +AD4APgA+AD4 You might find it easier to use a compiler that warns you when you've apparently forgotten to use the KIND argument of CMPLX.
+AD4 +AD4
+AD4 +AD4 You also ignored the point that some users may find that their programs
+AD4 +AD4 deliver more accurate results.
+AD4 +AD4
+AD4 +AD4APg Such compilers are in fact available.
+AD4 +AD4
+AD4 +AD4 That's useful, but irrelevant.
+AD4 +AD4
+AD4 +AD4 ---
+AD4 +AD4 This email has been checked for viruses by Avast antivirus software.
+AD4 +AD4 https://www.avast.com/antivirus
+AD4
+AD4 Bill Long longb+AEA-cray.com
+AD4 Principal Engineer, Fortran Technical Support +ACY voice: 651-605-9024
+AD4 Bioinformatics Software Development fax: 651-605-9143
+AD4 Cray Inc./ 2131 Lindau Lane/ Suite 1000/ Bloomington, MN 55425
+AD4
+AD4
|