sqrt with integer argument

In the new version 10.1, sqrt() doesn’t allow integer argument

integer :: n 
real :: x

x = sqrt(n)



PGF90-S-0074-Illegal number or type of arguments to sqrt

I have to explicitly convert it into either double using dble() or real using real(). Is this a bug?

Tuan

Hi Tuan,

The Fortran standard sqrt intrinsic has always had a prototype of “SQRT(x)” where X is a REAL or Complex. In order use an integer you would need to first convert it.

Though, I’m not sure how you’re getting this particular error. The code as shown should get a link error (undefined reference to ‘sqrt’) and adding an ‘implicit none’ will give a syntax error that ‘sqrt’ is not defined.

  • Mat

Thanks, Mat.

Tuan