From: Alexandros Droseltis on
Hello!

I am studying an ancient source written in Fortran IV (it is the
programme "Free Stochastic Music" by Xenakis in [1]) and I do not
understand the blank in the following line of code:

HX=HINF+HM*X RANF(-1)

By reading the theoretical text, I assume that RANF(-1) should be a
random number in [0,1). Also I assume by reading the theoretical text,
that HX should be a random number between HINF and HINF+HM.
Compiling the code with g95 and using a random number, say TEMP,
instead of RANF(-1), I always get for HX the value HINF and not what I
expect (that is a random number between HINF and HINF+HM). Could
someone please explain what the above assignment in Fortran IV means? I
would be grateful.

Best Regards

Alexandros


[1] Iannis Xenakis, Formalized Music; Thought and Mathematics in
Composition, Pendragon Press, Stuyvesant New York
From: Richard Maine on
Alexandros Droseltis <usenet-1(a)alex-droseltis.com> wrote:

> I am studying an ancient source written in Fortran IV (it is the
> programme "Free Stochastic Music" by Xenakis in [1]) and I do not
> understand the blank in the following line of code:
>
> HX=HINF+HM*X RANF(-1)
>
> By reading the theoretical text, I assume that RANF(-1) should be a
> random number in [0,1). Also I assume by reading the theoretical text,
> that HX should be a random number between HINF and HINF+HM.
> Compiling the code with g95 and using a random number, say TEMP,
> instead of RANF(-1), I always get for HX the value HINF and not what I
> expect (that is a random number between HINF and HINF+HM). Could
> someone please explain what the above assignment in Fortran IV means? I
> would be grateful.

One can't tell for sure what is going on here without context (in
particular all the relevant declarations).

The simple answer is that blanks are insignificant in Fortran prior to
f90 (and in fixed source form in f90 as well). Thus the line means the
same as if the blank was not there. This would imply that the line was
referencing a function named xranf (or potentially an array of that name
- see above comment about the lack of adequate context).

The use of blanks like that is not a style of coding that I personally
like; I think it invites confucions such as yours. But it is legal.

There is no ranf or xranf in standard Fortran. I haven't even heard of
xranf as a common extension. The fact that your code reportedly runs at
all (if it didn't, I don't see how you could say what result it gets)
suggests that it is finding an xranf somewhere; possibly that function
is elsewhere in the source code you have. See again comment about lack
of adequate context.

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain
From: glen herrmannsfeldt on
Richard Maine <nospam(a)see.signature> wrote:
> Alexandros Droseltis <usenet-1(a)alex-droseltis.com> wrote:

>> I am studying an ancient source written in Fortran IV (it is the
>> programme "Free Stochastic Music" by Xenakis in [1]) and I do not
>> understand the blank in the following line of code:

>> HX=HINF+HM*X RANF(-1)

>> By reading the theoretical text, I assume that RANF(-1) should be a
>> random number in [0,1).
(snip)

> One can't tell for sure what is going on here without context (in
> particular all the relevant declarations).
(snip)

> The use of blanks like that is not a style of coding that I personally
> like; I think it invites confucions such as yours. But it is legal.

In Fortran I (not that I ever programmed in it) function names
were required to end in F. Functions returning a fixed point
value were required to start with X. (XRANF was not a function
included in the Fortran I library, though.)

Assuming this isn't a program with roots back to Fortran I days,
it might be that someone used to older systems kept the X naming
convention. The blank might have made it easier to change the
name when converting between systems. (Editing on cards isn't
quite the same as the editors available today.)

It would be interesting to see the rest of the program, which
might help explain the usage.


(snip)

-- glen

From: nmm1 on
In article <hcreo0$bth$1(a)naig.caltech.edu>,
glen herrmannsfeldt <gah(a)ugcs.caltech.edu> wrote:
>
>In Fortran I (not that I ever programmed in it) function names
>were required to end in F. Functions returning a fixed point
>value were required to start with X. (XRANF was not a function
>included in the Fortran I library, though.)

According to the documentation I have seen, user-written functions
didn't come in until Fortran II - it wasn't that they were required
to end in 'F', so much as the built-in ones did.

But a spurious blank could simply be accidental (the word 'error'
isn't right, as it is perfectly correct) - without seeing the rest
of the program, there's no way to tell.



Regards,
Nick Maclaren.
From: glen herrmannsfeldt on
nmm1(a)cam.ac.uk wrote:
(snip, I wrote)

>>In Fortran I (not that I ever programmed in it) function names
>>were required to end in F. Functions returning a fixed point
>>value were required to start with X. (XRANF was not a function
>>included in the Fortran I library, though.)

> According to the documentation I have seen, user-written functions
> didn't come in until Fortran II - it wasn't that they were required
> to end in 'F', so much as the built-in ones did.

Depends on your definition of user-written. In a paragraph near
the end:

"Library subroutines exist on the master Fortran tape in relocatable
binary form. Placing new subroutines on that tape involves
(1) producing the routine in the form of relocatable binary cards
(2) transcribing those cards on to the master tape by means of
the program provided for that purpose."

It doesn't even mention an assembler, but I presume one was available.

-- glen