Re: A question about "kind"?



"Simulate" <li.simula@xxxxxxxxx> wrote in message
news:b86f6f0d-8bcd-4556-8320-71c0ab0e4001@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Is there different between Fortran and C++? The answer is No.

The Fortran kind mechanism allows you to specify the kinds of
literals in a more flexible way than C++. Look at
http://home.comcast.net/~kmbtib/fft64t.i90 for example. all the
constants are defined to be of kind 'wp' in the subroutine. When
included in http://home.comcast.net/~kmbtib/fft64t.f90 all the
constants and variables magically have the kind type parameter of
double-precision. The could just as easily have been made single-
precision or even quad- or extanded-precision. It's much more
awkward to set the kind type parameters of literals in C++. You
would probably have to rewrite any expression for every possible
kind type parameter and use preprocessor directives to choose
between them.

--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end


.