This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Need some help here


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]