Re: Rounding off double precision



On Mon, 31 Mar 2008 17:45:41 +0100, Les wrote:

"Bamm" <bammster@xxxxxxxxx> wrote in message
news:eab4fbe9-3cf4-4015-9a87-e5e9a872f808@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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.

So how do you declare a constant in Fortran? I thought parameter was
the way constants were defined in Fortran, but if there is a better
way, I'd like to try it.

you would use something like :
double precision, parameter :: PI = 3.14159.......d0

integer, parameter :: ITYPE = 1

and so on

That, of course, is the preferred Fortran 90 syntax, but the Fortran 77
method

double precision pi
parameter (pi = 3.14159265358979d0)

also has the desired effect and is closer to what was originally asked.




--
Dave Seaman
Court affirms Judge Yohn's ruling.
<http://www.ipsnews.net/news.asp?idnews=41761>
.



Relevant Pages

  • Re: Rounding off double precision
    ... Not in Fortran, unless "Pi" has been typed DOUBLE PRECISION or has the ... The text you quoted above reads "creates a literal constant ... that it is being assigned to a single-precision parameter is something ...
    (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)
  • Re: modifying constants
    ... Fortran has literal constant forms for all ... literal constant forms for all intrinsic types. ... bit string, I'm confident. ... "make way" for decimal floats. ...
    (comp.lang.fortran)
  • Re: IF DEAD, GOTO 10-3-39
    ... -> -What does FORTRAN offer you that you don't find in anything else nowadays? ... -> Are there still any implementations that pass literal parameters by reference? ... Are we using the mathematical definition of "literal constant" or are ... If we're using the mathematical definition of literal constant, ...
    (rec.sport.football.college)
  • Re: Rounding off double precision
    ... because I didn't declare Pi to be double precision, ... C uses #define is places where Fortran uses PARAMETER, ... has type double precision, in Fortran, the literal constant "0.1" has ... type single precision. ...
    (comp.lang.fortran)