Re: Rounding off double precision



On Mar 31, 10:34 am, Dave Seaman <dsea...@xxxxxxxxxxxx> wrote:
On Mon, 31 Mar 2008 06:55:27 -0700 (PDT), Chip Coldwell wrote:
Getting back to the OP,
parameter(Pi = 3.141592653589793238d0)
creates a literal constant with the double-precision value

Not in Fortran, unless "Pi" has been typed DOUBLE PRECISION or has the
appropriate KIND. By default, the double precision constant is truncated
to type REAL.

If you add "implicit none" to the program, the compiler complains because
"Pi" has not been given an explicit type.

Sigh. The text you quoted above reads "creates a literal constant
with the double-precision value". The literal constant is
"3.141592653589793238d0" and is a double precision value. The fact
that it is being assigned to a single-precision parameter is something
different. A parameter is not a literal constant and vice-versa.

Chip
.



Relevant Pages

  • Re: Rounding off double precision
    ... has type double precision, in Fortran, the literal constant "0.1" has ... A double precision constant as a single precision PARAMETER ... but PI itself is typeless. ...
    (comp.lang.fortran)
  • Re: Rounding off double precision
    ... "3.141592653589793238d0" and is a double precision value. ... that it is being assigned to a single-precision parameter is something ... A parameter is not a literal constant and vice-versa. ... So how do you declare a constant in Fortran? ...
    (comp.lang.fortran)
  • Re: Rounding off double precision
    ... "3.141592653589793238d0" and is a double precision value. ... A parameter is not a literal constant and vice-versa. ... literal constant to a single precision named parameter: ... you can assign a single precision literal constant to a double ...
    (comp.lang.fortran)
  • Re: Rounding off double precision
    ... A parameter is a symbolic constant, not a literal constant. ... support quad precision, there is no statement that will work. ... will work on any processor that uses increasing kind values for ...
    (comp.lang.fortran)
  • Re: Rounding off double precision
    ... Not in Fortran, unless "Pi" has been typed DOUBLE PRECISION or has the ... that it is being assigned to a single-precision parameter is something ... A parameter is not a literal constant and vice-versa. ...
    (comp.lang.fortran)