Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

why dsqrt() doesn't work

ywangsiom
Beginner
3,120 Views
I have check the help for dsqrt(). it's nearly same with sqrt() and
the complier is OK with sqrt().
Would anyone can explain for me ?
Error: This name does not have a type, and must have an explicit type. [DSQRT] r1=dsqrt(r2)
0 Kudos
2 Replies
TimP
Honored Contributor III
3,120 Views
While you would expect a legacy Fortran compile to perform automatic typing of functions such as DSQRT(), the compiler has not done so. As you figured out, the normal way for the last 25 years has been to use the generic sqrt() (except for the case where you pass a function name in a function call). So, there would not be any normal usage where you would not be required to declare the non-generic function, either by interface block or by DOUBLE PRECISION DSQRT. If you choose to use DSQRT, the compiler might not be able to check your argument number and type, unless you provide an interface block.
0 Kudos
Steven_L_Intel1
Employee
3,120 Views
You did not show all the messages. I am certain that you also saw something like this:

Warning: This argument's data type is incompatible with this intrinsic procedure; procedure assumed EXTERNAL. [DSQRT]

(Unless you suppressed warnings.)

You had IMPLICIT NONE and gave to DSQRT an argument that was not DOUBLE PRECISION. The latter caused the warning, since DSQRT is not generic, and then the compiler complained that you did not declare DSQRT since it was no longer an intrinsic.

If you had called DSQRT with a proper double argument, the compiler would have been happy.

Message Edited by sblionel on 10-11-2005 09:09 AM

0 Kudos
Reply