Re: OT: The Most Unexpected AND Interesting Discovery about QBasic



Reef Fish... The best I can say is that I learned early in the game
that changing the limits on the counter in a loop is a bad idea in any
coding language. When I had some programmers working for me (I
inherited them from a defrocked manager ca. 1975) I tested them by
writing code with subtle changes in loop counters (in Fortran IV)...
getting "funny" outcomes... and then asking one of them for help. They
all failed these tests so I spent a lot of time finding work for them
in other places.

The trick I used was this. I'd put a call to a subroutine... that call
being inside a loop. One of the arguments in the call was the loop
counter... which I would change inside the subroutine. Since Fortran
lets us use one name for variables in the calling statement and a
different name inside the called subroutine, this was a bit subtle. But
not that subtle.
(It's only the position of the variable or argument in the calling
statement that matters.) There are many funny quirks in Fortran IV.
This one is relatively easy to find. Some others are not. For
instance, an argument in calling statement could be changed to a
constant inside the subroutine
by just putting a constant where there should be a variable. The list
of possibilities for messing up Fortran code is endless.

Aside from this, I contend that changing the value of a counter (or
it's initial and termination values) inside a loop is dangerous no
matter what the standards or the "user manuals" may say.

Like you, I started "coding" using assembly language and tweaking
machine code albeit this was in 1956 with an IBM 650. With a rotating
drum for storage, and working in miliseconds, reading and writing to
the drum memory could be tricky. If you tried to "read" just after the
place you wanted to read from has passed by the read head then you'd
lose a few miliseconds before it would come back around again. Do that
repeatedly and the action could be very slow. So to write efficient
code you had to not only code correctly but also pay attention to
"where's the read/write head". When I hear people complain that their
computer is not fast enough I just laugh. We had two IBM 650s and had
to sign up for "time on the machine". Being new to the organization I
usually ended up with 2:00 a.m. - 4:00 a.m. The first "moving on up"
language I encountered was Runcible (spelling...?) Then came an early
version of Fortran... amazing!! I was working for the govt. agency
that was being converted into NASA at that time. The prior agency
(NACA) was devoted to jet engines and the new NASA organization was of
course all about rockets and rocket engines. We were under a lot of
heat when the Russians launched Sputnick, and so we worked incredible
hours with limited resources. This meant haggling with others over
getting "machine time".

As you may know, I'm a chemical engineer and a statistician... a
half-breed. So my thinking is strongly flavored by thinking like an
engineer.
Hence... "perfection is the enemy of good enough", etc.
Please forgive me if I sometimes get testy, and know that I actually
appreciate your attempts to teach some difficult people via
sci.stat.math.
Trust me... I deal with some difficult people among my clients. I have
no tolerance for people who try to use "statistics" as a weapon... to
"prove they are right".

By the way, I intend to copy your post re: principal components and
factor analysis and send it (with credit and the link to it) to a
"Six-Sigma Master Black Belt" who is wandering around in deep sticky
with factor analysis. So far I've not been able to nudge him away from
the wonders of factor analysis. If you have any problem with me doing
that, please let me know.

You've given us a long list of phobias to investigate. Some may come
in handy.

Air travel is not the fun it once was. My problem yesterday was very
bad weather combined with delays and cancelled flights. Yes, I've "seen
the world" with travel financed by other people. But after 9/11 it's
not the same.

Take care... and know that I read your posts to learn and not to be
antagonistic.

.



Relevant Pages

  • Re: About alternatives to Matlab
    ... But whether a single loop is faster than several BLAS calls does not ... Bad Fortran 95 can easily be 25% lower than well-tuned C99. ... NumPy can be slower than equivalent C by an order of magnitude. ... manipulated within Python, not the speed of python code using NumPy ...
    (comp.lang.python)
  • Re: Coding in Fortran
    ... I would like to start some programming in fortran. ... a loop got performed at least once. ... That f77 feature was one of the last to be implemented uniformly. ...
    (comp.lang.fortran)
  • Re: should every thing be zero indexed?
    ... Jim Rogers wrote: ... >> This for loop would have the structure of a quantification: ... >> as, arrays. ... > I acknowledge that the concept of arrays was used heavily in Fortran, ...
    (comp.programming)
  • Re: dynamic type in function calls?
    ... using the C preprocessor and #define with Fortran. ... Compile time expansion could probably also be done with preprocessor ... The old favorite example would do loop ... unrolling for small loop sizes, ...
    (comp.lang.fortran)
  • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
    ... >> both less efficient and less safe than the Fortran and Basic standard. ... >> The C for loop is actually trying to do what a do loop does. ... sloppy thinking that results from confusing a programming language ... > I do not believe that you are capable of writing a conforming C compiler. ...
    (comp.programming)