This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: Need some help here
- From: Janne Blomqvist <jblomqvi at cc dot hut dot fi>
- To: François-Xavier Coudert <Francois-Xavier dot Coudert at lcp dot u-psud dot fr>
- Cc: gfortran <fortran at gcc dot gnu dot org>, Jerry DeLisle <jvdelisle at verizon dot net>
- Date: Thu, 25 Nov 2004 12:04:56 +0200
- Subject: Re: Need some help here
- References: <1101372424.4064.20.camel@localhost.localdomain> <41A5A091.7000102@lcp.u-psud.fr>
On Thu, Nov 25, 2004 at 10:06:25AM +0100, François-Xavier Coudert wrote:
> >h=0.1_wp
>
> I'm not very good in variable kinds details, but I was taught to let the
> compiler alone: if h is declared as real(kind=wp), h=0.1 should work OK.
> Can someone confirm this?
My understanding is that without an explicit kind, the standard
specifies that constants shall first be converted into the default
kind (in this case default real, i.e. single precision) before being
assigned to the actual variable (which in turn might imply yet another
type conversion). Thus, by specifying the kind explicitly, possible
loss of precision is avoided.
--
Janne Blomqvist