Newsgroups: comp.lang.fortran
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!casbah.acns.nwu.edu!earth!ravi
From: ravi@earth.ce.nwu.edu (Ravi Sinha)
Subject: Re: Fortran 90 status
Message-ID: <1991May20.182514.17651@casbah.acns.nwu.edu>
Sender: news@casbah.acns.nwu.edu (Mr. News)
Nntp-Posting-Host: earth.ce.nwu.edu
Organization: Civil Engineering Dept., Northwestern University
References: <1991May16.195328.727@casbah.acns.nwu.edu> <JKORPELA.91May17111428@vipunen.hut.fi> <1991May20.174853.25490@unixg.ubc.ca>
Date: Mon, 20 May 1991 18:25:14 GMT
Lines: 40

>>The point is that using a real control variable leads to INACCURACIES.
>>A value such as 0.1 is not reprented exactly on most computers. The
>>inaccuracy is small but it is ACCUMULATED. Thus the values for which
>>the loop is actually executed differ from what you probably expect.
>
> Slide rules were inexact, too.  But we still let one another
> use them; similarly, we should let one another go on applying
> FORTRAN 77's admirable principle of allowing use of any type
> which makes sense in the context, one of these contexts being
> DO control statements.

I was the original poster with the abominable example where the DO loop
increment value was 0.1.  Several people have noted, both here and
through email that integer DO loop control variable is better for this
example where round-off would cause error in the number of times the
loop is evaluated.  Well, it was a BAD example and almost everyone
missed the point...

The point is:
If you allow a language to have a feature which can be used very
intuitively, should you remove the feature later on?  If we are 
dealing with real variables, real DO loop control variables *are*
the most intuitive choice.  So, do you want to leave the onus of 
being correct on the compiler writers, or on the end users?  How 
about requiring that all real DO control variables should be 
evaluated in extended precision (R*16), and the result passed back in 
REAL or DOUBLE as the case may be.  Would this take care of roundoff 
errors in all cases?  And how does the overhead compare 
with using integer DO variables and calculating the REAL variable 
from it?


To make peace with those who have considered me to be sigularly
incompetent:  Through years of habit, I never use real DO variables.
This is why it didn't occur to me that increment size of 0.1 is 
not a very good choice for this example.

Ravi Sinha			|  <standard disclaimers here>
Northwestern University		|  <cute quote here>
ravi@earth.ce.nwu.edu		|  <cute quote continued here>
