Strange behaviour using quadruple precision in Fortran using Mingw (Anaconda version)

120 views Asked by At
  • Windows 7 64 bits
  • GNU Fortran (GCC) 4.7.0 20111220 (experimental) --> The MinGW version installed with Anaconda3/Miniconda3 64 bits.

Hi all,

I'm trying to compile some Fortran code to be used from Python using F2Py. The full project is Solcore, in case anyone is interested. In Linux and MacOS everything works fine, the problem comes with Windows. After some effort I've nailed down the problem to the quadruple precision variables of my Fortran code, which are not being treated properly.

A minimum example that works perfectly well in Linux/MacOS but not in Windows is:

program foo
  real*16 q, q2
  q = 20
  q2 = q+q
  print*, q, q2
end program foo

In Linux/MacOS this prints, as expected:

20.0000000000000000000000000000000000         40.0000000000000000000000000000000000

However, in Windows I get:

2.00000000000000000000000000000000000E+0001 1.68105157155604675313133890866087630E-4932

Keeping aside the scientific notation, clearly this is not what I expected. The same result appear any time I try to do an operation with quadruple precision variables and I cannot figure out way.

This is not the same error already pointed out with quadruple precision variables in Fortran and the MinGW version included in Anaconda.

Any suggestion will be more than welcome. Please, keep in mind that, ultimately I need to make this work with F2Py, and MinGW included in Anaconda is the only way I have found in the end to make it work after reading many instructions and tutorials. Therefore, I would prefer to stick to it, if possible.

Many thanks,

Diego

0

There are 0 answers