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 16 of 40 Topic 8533 of 8908
Post > Topic >>

Re: whole number constants

by nospam@[EMAIL PROTECTED] (Richard Maine) Jul 21, 2008 at 04:38 PM

<dancerchris@[EMAIL PROTECTED]
> wrote:

> Do compilers use the same value for multiple
> use of an integer in an equation of specified kind

I can't parse that question... and I think that is exactly part of the
problem. I think you are confusing multiple concepts. Namely...

There is no such thing as "an equation of a specified kind". Kind is not
a property of a whole equation. That's actually im****tant and
occasionally confuses people. Each individual entity in an expression
has a type and kind, as does each operation result.

"Same value for mutiple use of an integer". I think I know what you are
asking there, but I'm having to guess, as the words don't quite parse.
There is one variant of the question that is quite subtle... but that
variant doesn't apply to integers. Repeat after me, small integer values
are exact.

> 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).

Sorry, but just plain *NO*. That is not so. There are so many thing
wrong here, it is hard to list them.

There is no such thing as a "true constant." A constant of a particular
kind is of that kind. There is no concept of a constant that is of a
given kind, but actually has extra bits. Sorry, but there just isn't. I
can pretty much guarantee that if you are about to use this term in a
sentence, then the sentence is going to be wrong. I pretty much don't
have to read th erest of the sentence (but I did).

Also, I don't know what distinction this is that you are making between
"machine level" and the real kind. Except in the rare case of software
floating point, the machine representation *IS* that of the kind in
question. The kind facility maps onto the representations that the
machine sup****ts. There aren't going to be "extra bits". There are
sometimes issues related to machine registers that can be wider than
some of the sup****ted kinds, but that affects only tem****ary
calculations. That can give rise to complications, but not in the ways
you are looking. It certainly does not correlate in any way with the
syntax used for constants. And such things are never "copied from the
storage register completely," that being sort of the point of them.

Finally, I must note that you specifically asked about whole numbers. It
really does make a difference. Whole numbers of modest magnitude are
represented exactly in every kind on every compiler that you will ever
see. There aren't going to be any extra bits (except for zero bits) or
lost precision, no matter what kind you are talking about.

>  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)

The value of 1.0 to dp accuracy is the same as its value to single
precision accuracy, which is the same as its value to any other
accuracy, including infinite accuracy. There aren't any other values it
will ever have. Don't generalize this to non-whole numbers, though.

I'm thinking you need to read Goldberg's "What Every Computer Scientist
Should Know About Floating-Point Arithmetic"
(<http://docs.sun.com/source/806-3568/ncg_goldberg.html>),
but I'm
afraid your confusions might actually be more fundamental thanthat.
Still, reading it is unlikely to hurt.

-- 
Richard Maine                    | Good judgement comes from experience;
email: last name at domain . net | experience comes from bad judgement.
domain: summertriangle           |  -- Mark Twain
 




 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:53:30 CST 2008.