Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Fortran > Re: whole numbe...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 21 of 40 Topic 8533 of 8908
Post > Topic >>

Re: whole number constants

by glen herrmannsfeldt <gah@[EMAIL PROTECTED] > Jul 21, 2008 at 04:52 PM

dancerchris@[EMAIL PROTECTED]
 wrote:
(snip)

> Thanks RM.  I do understand that a parameter has a constant value.  My
> question was the relation****p 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.

For mixed mode arithmetic, such as between different KINDs of
REAL values, the shorter is always extended to match the
longer type before the operation (+, -, *, or /) is performed.
(** is a different question).   I don't know that the standard
requires that zero bits be used in doing that, but all systems
I know do that.  With zero extending integer 1 or single precision
1. or 1.E0 will exactly equal double precision 1.D0.

> Sorry if I'm being thick.

There is an interesting feature that I only know of in the
IBM Stretch machine.  When doing post normalization on
floating point values, one can choose to ****ft in zeros
or ones.  One can run a program both ways, and compare
the results.  Using that option, 1000001.-1000000. would
be much different from 1.0, but I don't believe that
extending either integer or single precision would
be done differently.

There is also stochastic rounding, where values half way
in between two rounded values are randomly rounded one
way or the other.  One might also suggest using random
bits for post normalization.  I don't know any that
do, though.

-- glen
 




 40 Posts in Topic:
whole number constants
dancerchris@[EMAIL PROTEC  2008-07-21 14:16:11 
Re: whole number constants
Craig Powers <craig.po  2008-07-21 17:20:00 
Re: whole number constants
dancerchris@[EMAIL PROTEC  2008-07-21 14:27:13 
Re: whole number constants
nospam@[EMAIL PROTECTED]   2008-07-21 15:00:02 
Re: whole number constants
Dick Hendrickson <dick  2008-07-21 21:30:53 
Re: whole number constants
"robin" <rob  2008-07-22 05:34:44 
Re: whole number constants
Dick Hendrickson <dick  2008-07-22 15:02:50 
Re: whole number constants
"robin" <rob  2008-07-23 05:14:08 
Re: whole number constants
Dick Hendrickson <dick  2008-07-23 15:26:15 
Re: whole number constants
dancerchris@[EMAIL PROTEC  2008-07-21 14:49:41 
Re: whole number constants
glen herrmannsfeldt <g  2008-07-21 15:33:55 
Re: whole number constants
dancerchris@[EMAIL PROTEC  2008-07-21 14:52:15 
Re: whole number constants
nospam@[EMAIL PROTECTED]   2008-07-21 15:27:09 
Re: whole number constants
"robin" <rob  2008-07-22 05:34:36 
Re: whole number constants
dancerchris@[EMAIL PROTEC  2008-07-21 15:51:23 
Re: whole number constants
nospam@[EMAIL PROTECTED]   2008-07-21 16:38:16 
Re: whole number constants
Paul van Delst <Paul.v  2008-07-22 09:24:25 
Re: whole number constants
glen herrmannsfeldt <g  2008-07-22 09:11:17 
Re: whole number constants
"robin" <rob  2008-07-23 05:14:05 
Re: whole number constants
"J. F. Cornwall"  2008-07-23 19:15:05 
Re: whole number constants
glen herrmannsfeldt <g  2008-07-21 16:52:25 
Re: whole number constants
nospam@[EMAIL PROTECTED]   2008-07-21 17:41:43 
Re: whole number constants
dancerchris@[EMAIL PROTEC  2008-07-21 15:58:09 
Re: whole number constants
Paul van Delst <Paul.v  2008-07-22 09:14:32 
Re: whole number constants
dancerchris@[EMAIL PROTEC  2008-07-21 17:49:19 
Re: whole number constants
"robin" <rob  2008-07-22 05:34:37 
Re: whole number constants
nospam@[EMAIL PROTECTED]   2008-07-22 01:35:01 
Re: whole number constants
glen herrmannsfeldt <g  2008-07-22 09:19:55 
Re: whole number constants
"robin" <rob  2008-07-23 05:14:06 
Re: whole number constants
glen herrmannsfeldt <g  2008-07-22 23:39:36 
Re: whole number constants
"robin" <rob  2008-10-02 14:56:53 
Re: whole number constants
"robin" <rob  2008-10-02 14:56:52 
Re: whole number constants
glen herrmannsfeldt <g  2008-10-02 13:44:10 
Re: whole number constants
glen herrmannsfeldt <g  2008-07-24 22:06:52 
Re: whole number constants
Thomas Koenig <tkoenig  2008-07-22 08:04:03 
Re: whole number constants
lindahl@[EMAIL PROTECTED]  2008-07-22 03:07:29 
Re: whole number constants
"Les" <l.nei  2008-07-22 11:34:53 
Re: whole number constants
glen herrmannsfeldt <g  2008-07-22 09:24:39 
Re: whole number constants
Thomas Koenig <tkoenig  2008-07-24 06:17:59 
Re: whole number constants
Michael Prager <Mike.P  2008-07-24 10:21:33 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Nov 19 7:55:40 CST 2008.