> Date: Sat, 06 Mar 2004 16:06:17 -0700
> From: James Giles <[log in to unmask]>
> Robin wrote:
> >> Date: Sat, 06 Mar 2004 12:05:45 +0900
> >> From: Yasuki Arasaki <[log in to unmask]>
> >
> >> The one thing I don't like about Fortran is [...] the fact that default
> >> real seems to be converging on four bytes. In F77 days I used only
> >> DOUBLE PRECISION with all real literals with a D exponent. That was
> >> ugly then, but in F90 I explicitly specify kind parameters for all
> >> real literals (not really all, I use "2" instead of "2.0_rk").
> >> Fortran is supposed to be for number crunching, but the most
> >> convenient default real can not be trusted.
> >
> > In what way?
> > Default real is default real.
> > 1. 2. 3. 4. 5. etc are default reals.
> > They are always default real.
> > They never change from default real.
>
> But, default real is what the implementation says it is. There is
> no reason that a compiler directive or command-line switch
> couldn't be provided that allows the user to select what precision
> default real is compiled to.
Might be a problem with reference to user-defined generic functions
that rely on precision differences to resolve the reference.
Might also make a program non-portable.
> Some compilers already do so. If
> such a control were part of the standard, it would be a much
> better solution to a common problem (changing the KIND used
> by the whole program) than having to rewrite every literal in
> the whole program so that it includes KIND specifiers.
Could be better to have a declaration statement to specify that.
But changing the kind for the whole program can be done now
by using appropriate declarations for the relevant variables and
suffixes for constants.
> Literals without KIND are more legible for a start.
>
> --
> J. Giles
|