When I suggested CMPLEX earlier this morning I forgot that among the
possibilities for CMPLX(X,Y) are X of any real or integer kind and Y
of any real or integer kind, perhaps different from that of X, and
that BOZ literal constants are also allowed. What complex kind would
Robin want if X and Y are not of the same type, or of the same type but
different kinds?
> Date: Tue, 6 Jun 2017 10:06:47 +1200
> From: John Harper <[log in to unmask]>
> Reply-To: Fortran 90 List <[log in to unmask]>
> To: [log in to unmask]
> Subject: Re: Features for the next Fortran Standard (following Fortran 2015)
>
> Could we solve the problem by having a new intrinsic perhaps called CMPLEX
> that is fully generic, as well as the existing CMPLX, which isn't?
>
> On Fri, 2 Jun 2017, Malcolm Cohen wrote:
>
>> Date: Fri, 2 Jun 2017 17:30:08 +0900
>> From: Malcolm Cohen <[log in to unmask]>
>> Reply-To: Fortran 90 List <[log in to unmask]>
>> To: [log in to unmask]
>> Subject: Re: Features for the next Fortran Standard (following Fortran
>> 2015)
>>
>>> The proposal does not invalidate any old programs.
>>
>> Unfortunately it does, it invalidates programs going all the way back to
>> Fortran 77.
>>
>>> And some users could well find that their programs begin giving
>> more-accurate results !! because they did not use CMPLX correctly (and
>> inadvertently had their double-precision values quietly converted to single
>> precision).
>>
>> And other users could well find their programs failing to compile, giving
>> incorrect results, or crashing at runtime because they are now passing
>> things twice as big as before, but the receiver is not expecting that.
>>
>>> The inadequacy of the existing CMPLX has caught professionals.
>>
>> Which is precisely why I wrote:
>>>> You might find it easier to use a compiler that warns you when you've
>>>> apparently forgotten to use the KIND argument of CMPLX.
>>
>> Such compilers are in fact available.
>>
>> Cheers,
>> --
>> ........................Malcolm Cohen, NAG Oxford/Tokyo.
>>
>
>
> -- John Harper, School of Mathematics and Statistics
> Victoria University, PO Box 600, Wellington 6140, New Zealand
> e-mail [log in to unmask] phone (+64)(4)463 5276 fax (+64)(4)463 5045
>
-- John Harper, School of Mathematics and Statistics
Victoria University, PO Box 600, Wellington 6140, New Zealand
e-mail [log in to unmask] phone (+64)(4)463 5276 fax (+64)(4)463 5045
|