On 4/6/2017 11:28 AM, Vipul Parekh wrote:
> More specifically, consider the following from the scenario you
> presented involving some generics: the blog in question (the one I
> mentioned in the first note) effectively considered 2 of these options
> and emphatically states SELECTED_REAL_KIND is what coders should use.
As the author of the blog in question, I have been glad to see the
active discussion. Would that all my blog posts generate such intense
debate!
I wrote in the blog that word sizes (and sizes of default integers and
reals) have changed through the history of Fortran, an observation
supported by many in this thread. Furthermore ,IEEE float is a relative
newcomer to the field, and while it is very common today, that doesn't
mean it is ubiquitous nor that it will always be the primary choice.
I'll note that even today there are oddball float sizes (8, 10 and 11
bit to name three) in use by graphics processors.
The main reason I don't like REAL64 and its kin is that it tells you
nothing about the type other than the storage size. The only thing it is
good for, in my view, is as a direct replacement for REAL*8 in code that
wants to pass standards checking, with no concern about portability or
future-proofing. It is very simple to define a handful of kind
constants in a module and use those; at least then you're making a
conscious decision of what precision, range (and radix!) you're
expecting to use.
As for concerns about data interchangeability, for that the REAL64 and
similar constants are even less appropriate. Maybe that data file has
VAX G_float or is "opposite-endian". Data formats have additional
constraints not solved even by SELECTED_REAL_KIND.
Steve
|