Re: Rounding off double precision
- From: *** Hendrickson <***.hendrickson@xxxxxxx>
- Date: Thu, 03 Apr 2008 16:10:34 GMT
Gerry Ford wrote:
"Dave Seaman" <dseaman@xxxxxxxxxxxx> wrote in message news:fstcm0$4eh$1@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxIt depends on what you want to do. If the processor doesn'tOn Mon, 31 Mar 2008 22:04:56 -0700, Gerry Ford wrote:I didn't know that.
"Dave Seaman" <dseaman@xxxxxxxxxxxx> wrote in messageAnd in your example, "dp" is a symbolic constant and "1d0" is a literal
news:fssah4$iv8$2@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Mon, 31 Mar 2008 19:43:46 -0700 (PDT), Bamm wrote:I think illustrative source snippets go a long way:A parameter is a symbolic constant, not a literal constant.A parameter is not a literal constant and vice-versa.what's the difference? I thought parameter was fortran's way of
declaring a constant.
INTEGER, PARAMETER :: dp = kind(1d0)
is probably the parameter I get the most mileage from.
constant.
INTEGER, PARAMETER :: qp = kind(???)
Is there an analogous literal here? It sounds like I'm trying to buy pot.:-)
support quad precision, there is no statement that will work. ;)
But, if you need quad and want the program to fail at compile
time if quad isn't available, then something like
integer, parameter :: qp = kind (precision(1.0D0) + 5)
real (qp) :: xxx
will give you a higher precision on machines that support more than
single and double.
If you want to be able to use quad if it is there, and use double
otherwise, something like
integer, parameter :: qp_help = kind (precision(1.0D0) + 5)
integer, parameter :: qp = max(dp, qp_help)
will work on any processor that uses increasing kind values for
increasing precisions. James van Buskirk (I think) has a much better
way that works in the general case; but it's too complicated
for me to remember :( .
*** Hendrickson
.
- Follow-Ups:
- Re: Rounding off double precision
- From: Herman D . Knoble
- Re: Rounding off double precision
- From: FX
- Re: Rounding off double precision
- References:
- Re: Rounding off double precision
- From: Bamm
- Re: Rounding off double precision
- From: Dave Seaman
- Re: Rounding off double precision
- From: Gerry Ford
- Re: Rounding off double precision
- From: Dave Seaman
- Re: Rounding off double precision
- From: Gerry Ford
- Re: Rounding off double precision
- Prev by Date: Re: Reference to derived type element by index?
- Next by Date: Re: Rounding off double precision
- Previous by thread: Re: Rounding off double precision
- Next by thread: Re: Rounding off double precision
- Index(es):