I've had only a couple of small problems interpreting the venerable
(Hollerith codes - carriage control codes - eek!) FORTRAN dialect. Two
function calls do not appear in the list of FORTRAN library functions
that I found in Murrill's _FORTRAN IV Programming_. The first is XINTF,
it appears in lines like:
IFORM=XINTF(RANF(-1)*BF+0.5)
(where IFORM is an integer, BF a float, and RANF the random number
generator) which leads me to deduce that it corresponds to the C function
"floor". Can anyone confirm this?
The other problematic function is the random function RANF referred to above.
All calls to the function have the form RANF(-1). The only thing that is
definite from context is that this returns numbers in the range 0 to 1. There
is dubious evidence that this range is inclusive of 1 and exclusive of 0,
i.e. 0.0 < RANF(-1) <= 1.0
Does the parameter -1 say something about the range of what is returned or
does it mean something else? It is apparently not a seed as there is a line
with a CALL to RANFSET(TIMEF(1)) that presumably takes care of such things.
Actually this makes for a third question: what is the time format returned
by TIMEF(1)?
The more serious problem I have is determining what algorithm was used for
random number generation. For some purposes, it would be desirable to be
able to reproduce the output of the program from the original runs (there
is reason to believe that, at least in some cases, the generator was not
seeded - this is not a program requiring really random randomness per se)
Thus I have written my code to ensure that the original statement order
is maintained, but I also need, of course, a way of recovering the original
sequence of random numbers. (This is also assuming that there were no
optimizing compilers in 1962 of a sophistication that would alter statement
order.)
As a random number generator is not included in the list of standard library
functions that I have, my fear is that a given RNG function might be part
of the personal library of a given programmer. At best, I figure a given
RNG was peculiar to a specific compiler or class of machines.
In Knuth's TAOCP (vII, p106, Table 1, Line 11), there is a set of constants
for the usual linear congruential algorithm that he implies were in
standard use on the 36 bit machines of the time. How standardized was the
use of this algorithm then? Would only someone experimenting with algorithms
use something else? Or were things a hodge-podge?
Any information on these topics that can be dredged from memory or old
documentation will be much appreciated. Pointers to a more appropriate
place to address my queries would help too, if I'm at the wrong tree.
Many thanks,
Scott Murray
P.S. If these questions really are too arcane to be answered in a net
forum like this I suppose I will have to send a query to the IBM archives.
Has anyone dealt with them? Are they reasonable? Or do they have
bureaucratic sticks up their butts?
According to "A Fortran Primer", Organick, 1963, p. 28, a variable name
ending with F and consisting of 4 to 7 characters including the F is
recognized as being the name of a predefined function. Those that produce
an integer value start with X. I would suppose that XINTF is the modern INT,
which truncates towards zero, not FLOOR, which doesn't.
I would supect that the argument of RANF is a dummy as functions at that
time had to have an argument if if its value was not used. As the modern
RANDOM_NUMBER produces values from zero to just less than one, you might
find that is the case too with RANF.
Hope that helps,
Mike Metcalf
Since adding .5 and then truncating is the same as rounding to the nearest
integer, I would GUESS that this code generates a random 'real' number
between 0 and BF and then rounds it to the nearest integer.
> The other problematic function is the random function RANF referred to above.
> All calls to the function have the form RANF(-1). The only thing that is
> definite from context is that this returns numbers in the range 0 to 1. There
> is dubious evidence that this range is inclusive of 1 and exclusive of 0,
> i.e. 0.0 < RANF(-1) <= 1.0
> Does the parameter -1 say something about the range of what is returned or
> does it mean something else? It is apparently not a seed as there is a line
> with a CALL to RANFSET(TIMEF(1)) that presumably takes care of such things.
I would be surprised if the (-1) were not related to the seed, PERHAPS saying
continue with the same random number stream that has already been started.
--Jim Buddenhagen
Another person who responded by e-mail directed me to a site that actually
had some old manuals for IBM-7090 FORTRAN at
http://www.fh-jena.de/~kleine/history/
(either this is a new site or I was being a complete bonehead when I did
my web search a couple of weeks ago...)
This solved my first question: XINTF turns out to be truncation (as Mike
Metcalf suspected), with the initial X designating the return type as
fixed point. This form of type desigination is apparently a peculiarity
of FORTRAN II (and perhaps earlier versions), so at least I now have a
more sure idea of which dialect I'm dealing with.
Unfortunately there is no mention of random numbers in any of the manuals
so unless anyone can say otherwise, I suppose I'll have to assume that
the RNG was specific to the installation. The TIMEF function is also not
mentioned in the manuals.
Thanks again,
Scott