user5108_Dan
user5108_Dan

Reputation: 379

Do these 2 lines of Fortran represent a Fortran macro?

I am converting some Fortran code to C and I don't understand what is going on here.

This code came from TOMS, Transactions on Mathematical Software, so I don't believe this is an errant line of code.

ZCOS and A have no other definitions in the file other than what I am showing here. Is this a Fortran technique for defining ZCOS as COS, and if so, what does it accomplish?

REAL ZCOS
ZCOS(A) = COS(A)      
C(I) = ONE / (TWO * ZCOS ( C(I) * PI / DBLE(N+N) ))

Upvotes: 0

Views: 97

Answers (1)

This is a statement function, explained many times on SO. ZCOS is a real function and is defined in the first 2 lines.

The first line define the type of ZCOS.

The second line defines the function itself.

The third line could be an array access or another statement function. It cannot be decided without context.

Remark: Often, ZCOS is a specific functions for the COS generic, taking a double complex argument. It is a non-standard extension and your code does not use this intrinsic.

Upvotes: 2

Related Questions