[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Does your machine also FFT like mine?

From: John W. Eaton
Subject: Re: Does your machine also FFT like mine?
Date: Wed, 13 May 1998 14:45:31 -0500 (CDT)

On 13-May-1998, Kai Mueller <address@hidden> wrote:

| The man page says:
|   -fpconstant
|       Extend the precision of single precision constants assigned to
|       double precision variables to double precision.
| I have no idea why this is not the default

It has to do with when is the correct time to do the conversion to
double.  If I write

      double precision pi
      pi = 3.1415925358979

should this be evaluated as

  convert the string `3.1415925358979' to a single precision
  constant (thus losing some information) and then convert to double


  convert the string `3.1415925358979' to a constant with as much
  precision as necessary to avoid losing any information, then convert
  to a double precision constant.

If I recall correctly, there was quite a debate about this in the
comp.lang.fortran newsgroup several years ago.

Here is what the g77 manual has to say about this topic:

     `g77' strictly assigns types to all constants not documented as
  "typeless" (typeless constants including `'1'Z', for example).  Context
  is never a determining factor for the type, and hence the
  interpretation, of a typed constant.  Examples: `1' is always type
  `INTEGER', `9.435784839284958' is always type `REAL' (even if the
  additional precision specified is lost, and even when used in a `DOUBLE
  PRECISION' context), `1E0' is always type `REAL', and `1D0' is always

     Many other Fortran compilers attempt to assign types to typed
  constants based on their context.  This results in hard-to-find bugs,
  nonportable code, and is not in the spirit (though it strictly follows
  the letter) of the 77 and 90 standards.  `g77' will not support these
  dangerous semantics, but might offer, in a future release, explicit
  constructs by which a wider variety of typeless constants may be
  specified, and/or user-requested warnings indicating places where `g77'
  might differ from how other compilers assign types to constants.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]