I am programming a version of the BFGS algorithm for multidimensional optimization in Fortran 90. I have written the code, compiled it with gfortran on my laptop (running Windows Vista), and it works fine. But when I try to use the same code on a server running Linux 6, it gives incorrect results. It is the exact same code and it compiles fine, the results it produces are just wrong. Namely, it seems to be developing a floating point arithmetic error at some early phase of the algorithm and only produces one line of numerical results before it starts producing NaN’s. I can only assume it’s something about the server environment, but how can I find out what it is and how can I correct my code accordingly?
I am programming a version of the BFGS algorithm for multidimensional optimization in Fortran
Share
The problem is described here (CERT.org): FLP00-C. Understand the limitations of floating point numbers
The solution is described here: FLP02-C. Avoid using floating point numbers when precise computation is needed with two examples, an incorrect example showing the problem, and a corrected example without the problem: