PDA

View Full Version : Anyone know Fortran 77?


Chronos
06-29-2011, 11:50 AM
I'm trying to maintain an old piece of f77 code, and I've come across something of whose meaning I'm unsure. Ordinarily I resolve these problems by Googling, but I'm not even sure what keywords to search on here.

I have a line of code, near the beginning of a subroutine, that reads
DEX(DEXARG)=DEXP(2.302585*DEXARG)
Later in the code, this DEX thing shows up several more times, like so:
EMEI=DEX(EMEIL)
Now, it looks like what this is doing is creating a function called DEX, that's taking an argument and returning 10 to the power of that argument (the magic number there is the natural log of 10). But I can't find any documentation on this method of creating a function. Is this what's actually happening, and if so, what's this technique called?

friedo
06-29-2011, 11:55 AM
I don't know any Fortran, but if you don't have any luck here, try asking on Stack Overflow (http://stackoverflow.com/). They have a pretty diverse community.

Pasta
06-29-2011, 11:58 AM
This is an "inline fuction", indeed allowed in FORTRAN 77. It behaves in the way you would expect. It has to come before the first line of executable code (I think), among the variable declarations. Inline functions are dereferenced at compile time.

Baracus
06-29-2011, 11:59 AM
It is a "statement function (http://www.obliquity.com/computer/fortran/function.html)".

Chronos
06-29-2011, 12:10 PM
Wow, thanks, that was fast.

Cheshire Human
06-29-2011, 08:57 PM
It's been a long time since I've done 77, but I tried to figure it out, anyway. Then I got the bright idea of looking at the existing responses. Looks to me like Baracus got it. That's what I was sorta thinking. I second that. But I haven't even read, let alone written any FORTRAN in well over a decade. My vote is for what Baracus pointed you to. FWIW, which isn't much.