13.07.2015 Views

A Brief Introduction to Fortran 77 - Polaris

A Brief Introduction to Fortran 77 - Polaris

A Brief Introduction to Fortran 77 - Polaris

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Fortran</strong> includes a number of pre-defined intrinsic functionssuch as sin, cos, max, sign, etc. These are described inany <strong>Fortran</strong> manual.Statement functions are declared at the beginning of theprogram. The declaration has the form:fun ( d, d, ...) = ewhere the d’s are dummy arguments and e is an expressionthat may contain constants, dummy arguments, programvariables and references <strong>to</strong> any type of function.The type of the value returned by the statement functiondepends on the type associated with the function name. Thetype is assigned using either type declaration statements or, ifthe function name is not declared, the implicit rules describedabove for variables. An example of a statement function is:real mpyadd, b(100)...mpyadd(x,y,z) = x*y + z + 2 + sin(x)...y = mpyadd(a,b(5),1.0)© 1998 David A. Padua20 of 118

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!