Pierre Hugnett wrote:
>
> I gave up with SELECTED_REAL_KIND since I arrived to the conclusion
> that it can not be satisfactory when running on very different
> platforms (but this has been already discussed :-) )
>
I can believe that. What has not been discussed, IMHO, is that the
portability issue may mean different things to different people. To
some people, a self-contained program can be run on different machines
without any source code change or #ifdef is a portable code, and end of
the question.
However, it may not be the same _portability_ issue that other people
have to face with their software systems. In many systems, portability
means the software must be able to interface with its environment.
Therefore, _portability_ issues should include at least interfacing
with:
. Fortran code written in an old style with REAL/DOUBLE PRECISION;
. Fortran code written in one of new styles with KINDs;
. system libraries requiring REAL*4/REAL*8/REAL/DOUBLE PRECISION;
. external data (I/O) with absolute precisions;
. algorithmic requirements for specific (absolute) or optimal
(relative) decimal precisions.
Note that I am only listing those standard-conforming issues, except
REAL*4 and REAL*8 for absolute precisions.
I don't know if a _portable_ solution would ever exist. It is evident
to me that efforts have been made in the standard part to address the
issue. However, did the standard really offer a better solution?
Well, maybe, ~~. Or did it bring in new issues to the world like it is
suggested by the second bullet above, even if the first bullet was not
there? Well, I just don't know.
As an example, I would like to point out that two SELECTED_REAL_KIND()
solutions with a small difference _may_ imply two rather different
portability requirements:
1) Is this a relative precision solution?
> integer, parameter :: sp = kind(1.0) <= default REAL?
> integer, parameter :: dp = selected_real_kind(precision(1.0_sp)+1)
2) Is this an absolute precision solution?
> integer, parameter :: sp = selected_real_kind(1) <= REAL*4 or *2?
> integer, parameter :: dp = selected_real_kind(precision(1.0_sp)+1)
The only thing I am sure, it is a Can of worms. But it is a very good
Can! :-)
Jing
--
________________________________ _-__-_-_ _-___---
Jing Guo, [log in to unmask], (301)614-6172(o), (301)614-6297(fx)
Data Assimilation Office, Code 910.3, NASA/GSFC, Greenbelt, MD 20771
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|