Re: storing an integer in a double precision
- From: nospam@xxxxxxxxxxxxx (Richard Maine)
- Date: Fri, 6 May 2011 23:03:39 -0700
steve <kargls@xxxxxxxxxxx> wrote:
On May 6, 8:54 am, nos...@xxxxxxxxxxxxx (Richard Maine) wrote:
The compiler might do an increment and then test instead of computing
the trip count. The last increment would then overflow - well what was
supposed to be the last increment. That seems quite plausible to me.
Then the 'compiler' is not a Fortran compiler as 8.1.6.4.2
clearly states that the iteration count is tested for loop
termination,
I disagree that the standard specifies implementation at that level. The
standard just describes what the effect has to be. Other methods that
get the sam effect are allowed. Now you will probably note, quite
reasonably, that the other methods don't get the same effect. But the
differences are only when you hit overflow, which puts it outside the
guarantees of the standard.
You also seem to have elided my comment that
Also note that the value of i after the DO loop terminates should be
huge(i)+1, which puts you in "anything can happen" territory.
I think that is very pertinent, which is why I said it. Because of that,
nothing in the stanard basically guarantees anything for the program.
No, you don't get to limit the ways in which that could possibly cause
problems. The program is nonconforming and the compiler is allowed to do
all kinds of strange or not-so-strange things. It isn't required to
operate as otherwise expected up to that point. For example, a compiler
could, in principle, notice the problem and refuse to compile the code.
--
Richard Maine
email: last name at domain . net
domain: summer-triangle
.
- Follow-Ups:
- Re: storing an integer in a double precision
- From: Ron Shepard
- Re: storing an integer in a double precision
- References:
- storing an integer in a double precision
- From: Lynn McGuire
- Re: storing an integer in a double precision
- From: Richard Maine
- Re: storing an integer in a double precision
- From: steve
- Re: storing an integer in a double precision
- From: tholen
- Re: storing an integer in a double precision
- From: robin
- Re: storing an integer in a double precision
- From: gmail-unlp
- Re: storing an integer in a double precision
- From: robin
- Re: storing an integer in a double precision
- From: Ron Shepard
- Re: storing an integer in a double precision
- From: Richard Maine
- Re: storing an integer in a double precision
- From: steve
- storing an integer in a double precision
- Prev by Date: Re: storing an integer in a double precision
- Next by Date: Re: storing an integer in a double precision
- Previous by thread: Re: storing an integer in a double precision
- Next by thread: Re: storing an integer in a double precision
- Index(es):
Relevant Pages
|