Using the well-known DCMPLX intrinsic function, gfortran -g -std=f2008 -Wall -Wextra -O2 returns Warning: The intrinsic 'dcmplx' at (1) is not included in the selected standard but a GNU Fortran extension and 'dcmplx' will be treated as if declared EXTERNAL. Use an appropriate -std=* option or define -fall-intrinsics to allow this intrinsic. Is there a modern, cross-compiler way of manipulating double precision complex numbers?
If you want to convert to the double precision kind, whatever kind number it has, use
cmplx(real_part, imaginary_part, kind=kind(1.0d0))
Normally you should store the kind number in a named constant. If you actually do not want a double precision, but a fixed storage size, use named constants from the module iso_fortran_env, or the older method of specifing precision with selected_real_kind().
You can use:
CMPLX(X, Y, kind=REAL64)
To use REAL64, you need to import the module ISO_FORTRAN_ENV.
This is defined in section 13.7.36 in the Fortran 2008 Standard (Draft).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With