Quote:
Originally Posted by Matz
My problem is that the c code works with no problem in a 32 bit machine but it does not in a 64 bit machine
|
I assume you mean you recompiled both the C code and the fortran code for 64 bit mode to run on the 64 bit machine.
Depending on your real objective, you might have been better off keeping the 32 bit binary that worked on a 32 bit machine and using that on the 64 bit machine. You might need some extra library installed first, but in general it is easy to use 32 bit executables on a 64 bit Linux.
You could even recompile a 32 bit executable on a 64 bit Linux (again maybe needing some extra packages installed first).
But if you have good reason to want the executable to be 64 bit, that also ought to be possible.
There is an outside chance you are running into some calling convention issue, such that the passing of data between the C code and the Fortan is compiled correctly for 32 bit mode, but not for 64 bit mode. I don't think so, but I can't rule it out.
Other than that, I can only think of one theory that fits the symptoms and I can't follow the Fortran code well enough to estimate whether that theory fits:
In x86 32 bit architecture, the optimizer can use 80 bit floating point for intermediate values even when the code specifies float (32 bit floating point) or double (64 bit floating point). The code may accidentally depend on the extra precision. I can't follow the code, but it may compute some small difference that rounds to zero in 32 bit but nonzero in 80 bit, then use that as a divisor destroying the rest of the computation.
In x86-64 architecture, float or double each use exactly the nominal number of bits (32 or 64) never 80. So you don't get the extra precision that code might need.
Quote:
Maybe I should change some data type (from real to double), but I'm not sure.
|
The comments in that code suggest a change from real to double. It has a good chance to help. Why didn't you try before even asking? I'm not sure either.