Re: whole number constants
- From: dancerchris@xxxxxxxxxxxxx
- Date: Mon, 21 Jul 2008 15:51:23 -0700 (PDT)
On Jul 21, 3:27 pm, nos...@xxxxxxxxxxxxx (Richard Maine) wrote:
I think you are confusing yourself by inventing concepts that don't
exist. There is no such thing as a distinction between a "truly
constant" value and any other constant. A constant is a constant.
Thanks RM. I do understand that a parameter has a constant value. My
question was the relationship of inline usage of a number like label
50 of my original post. Do compilers use the same value for multiple
use of an integer in an equation of specified kind
for example if I specify a constant:
real(dp), parameter :: one = 1.0_dp
real(dp) :: x,xnew,error
100 error = one-xnew/x+one
200 error = 1.0_dp-xnew/x+1.0_dp
300 error = 1-xnew/x+1
it seems to me that label 100 is using a true constant such that the
numerical value out to the machine level (past kind dp) is consistant
in the equation (i.e. is copied from the storage register completely,
not just the significant digits). I think that label 200 does not
guarantee that, each instance of "1.0_dp" is assigned a value to the
dp accuracy (plus extraneous bits) 300 might but it depends on how
integers are assigned to real values and whether each instance of 1
is consistant.
Sorry if I'm being thick.
.
- Follow-Ups:
- Re: whole number constants
- From: glen herrmannsfeldt
- Re: whole number constants
- From: Richard Maine
- Re: whole number constants
- References:
- whole number constants
- From: dancerchris
- Re: whole number constants
- From: *** Hendrickson
- Re: whole number constants
- From: dancerchris
- Re: whole number constants
- From: dancerchris
- Re: whole number constants
- From: Richard Maine
- whole number constants
- Prev by Date: internal file and namelist
- Next by Date: Re: whole number constants
- Previous by thread: Re: whole number constants
- Next by thread: Re: whole number constants
- Index(es):