Hello,
I have a pedagological question for the Fortran teachers out there.
How does one write "best" an expression with mixed types, say:
complex(kind=sp) :: x,y
integer :: k
y=(k-1)/(k+1)*x
I recommend to students to explicitly write all the type conversions:
y=cmplx(k-1,0,sp)/cmplx(k+1,0,sp)*x
though
y=x*(k-1)/(k+1)
also works. This clouds readability to some extent.
What do you recommend?
Thanks,
Aleksandar
--
_____________________________________________
Aleksandar Donev
[log in to unmask]
http://www.pa.msu.edu/~donev/
Department of Physics and Astronomy
Michigan State University
East Lansing, MI 48825
(517) 432-6770
_____________________________________________
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|