Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RE: Function 'cosd' has no implicit type

Status
Not open for further replies.

billgray1234

Programmer
Mar 14, 2011
39
This is a quick reply to a previous post. I tried to reply to the original post directly, but the post had been declared 'closed'. So, i'm posting my reply here (as a 'new' post), in the hope that people might find it helpful.

The original post that i'm replying to was called

''Function 'cosd' has no implicit type''

and it can be found at


Anyway, below is my reply.
-----------------------------------------------
A 'subtle-but-important' note worth mentioning.

you need to distinguish between the terms INTRINSIC and IMPLICIT.

INTRINSIC refers to things which are 'built in' to fortran. they are basically a part of the fortran standard, such that you do not have to define/declare them. for example, the INTRINSIC mathematical functions SIN(x) and COS(x).

IMPLICIT refers to things that YOU create, specifically for your program. you have to explicitly define/declare them (that is, assuming you have included the statement IMPLICIT NONE). it can refer to either variables, functions, or subroutines. for example, you might create a function called

REAL FUNCTION CALCULATE_AGE(YEAR_BORN,CURRENT_YEAR)

to calculate someone's age, where YEAR_BORN is input as the year someone was born and CURRENT_YEAR is input as the current year, and the function 'result' would be

CALCULATE_AGE = CURRENT_YEAR - YEAR_BORN

you would have to explicitly declare the function CALCULATE_AGE (as well as the variables YEAR_BORN and CURRENT_YEAR) in the part of the program that 'calls' function CALCULATE_AGE. (you would also have to explicitly declare the variables YEAR_BORN and CURRENT_YEAR in function CALCULATE_AGE).


in regards to the original post, it sounds like SIN(x) and COS(x) are the INTRINSIC functions built in to fortran. in contrast, it sounds like SIND and COSD are functions that are IMPLICIT, so you might need to explicitly create/define/declare them yourself. note that i haven't heard of SIND or COSD, but, as someone has mentioned in one of the replies to that post, they MIGHT be INTRINSIC functions that are recognised by some compilers -- you would need to check).

anyway, i hope that helps clear things up!
 
(Some additions;)

COSD is NOT a part of the Fortran Standard: it's Sun Fortran extension. None the less it's intrinsic function (in the Sun Fortran dialect).

It's impossible to pass intrinsic functions and subroutines as arguments. As usually, intrinsic functions have generic and (type-)specific names. For example, SIN - generic name, DSIN, CSIN - specific names.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top