Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8979561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:52:33+00:00 2026-06-15T19:52:33+00:00

I am programming a version of the BFGS algorithm for multidimensional optimization in Fortran

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:52:35+00:00Added an answer on June 15, 2026 at 7:52 pm

    The problem is described here (CERT.org): FLP00-C. Understand the limitations of floating point numbers

    The reason for this behavior is that Linux uses the internal extended precision mode of the x87 floating-point unit (FPU) on IA-32 machines for increased accuracy during computation. When the result is stored into memory by the assignment to c, the FPU automatically rounds the result to fit into a double. The value read back from memory now compares unequally to the internal representation, which has extended precision. Windows does not use the extended precision mode, so all computation is done with double precision, and there are no differences in precision between values stored in memory and those internal to the FPU. For GCC, compiling at optimization level 1 or higher eliminates the unnecessary store into memory, so all computation happens within the FPU with extended precision

    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:

    “This code may be fixed by replacing the floating-point numbers with integers for the internal additions. Floats are used only when printing results and when doing the division to compute the mean.”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been programming a software version of a board game. Thus far I have
I have been programming with .NET 2.0 version for quite sometime and would like
I am programming through java 1.6 u_17, but i have JRE version 6 and
I have been using Emacs since version 18. Emacs Lisp isn't my routine programming
I'm programming an app that will have a free version. I have added another
I am beginning Java programming, and I have written a program which tests how
I'm going throgh Segaran's Programming Collective Intelligence using Windows version of PyPy. The author
For programming in my spare time, I have both a desktop and a laptop
In NetBeans 6.9 in windows version I use CygWin for C++ programming.I can compile
Programming language: Java Ok, so I want to have a BufferedImage that keeps rotating

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.