Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for dfloat function, extension or standard? #1077

Open
naromero77 opened this issue Mar 17, 2020 · 2 comments
Open

support for dfloat function, extension or standard? #1077

naromero77 opened this issue Mar 17, 2020 · 2 comments

Comments

@naromero77
Copy link

This dfloat intrinsic function appears frequently in a DOE code. Here is a reduced test case that shows a canonical example of how it is used:

      subroutine fwdcpfft_comp(psi, nr1, nr2, nr3)

      implicit none

      integer nr1, nr2, nr3
      complex*16 psi(nr1, nr2, nr3)

      real*8 fac

      fac = 1.0d0/dfloat(nr1*nr2*nr3)
      
      end

Is this part of the Fortran standard or an extension?
https://gcc.gnu.org/onlinedocs/gcc-4.4.1/gfortran/DFLOAT.html
https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-dfloat

Is this really even necessary to have such an intrinsic? Wouldn't a compiler's type promotion heuristics automatically handle this?

@klausler
Copy link
Collaborator

klausler commented Mar 27, 2020

DFLOAT is not a standard intrinsic procedure of Fortran. DBLE(n) and REAL(n,KIND=KIND(0.0d0)) are standard equivalents for integer n; so is (0.0d0+(n)). We'll probably support DFLOAT in f18 for better portability, but new code should avoid it.

@naromero77
Copy link
Author

Thanks for clarifying the correct way to do this. So far, I have only encountered this construct in one DOE code -- a rather old one at that.

If we are prioritizing non-standard extensions, it would be more important to get this one implemented sizeof:
#1020

As now I have found several DOE codes that make use of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants