Rate This Document
Findability
Accuracy
Completeness
Readability

Fortran Data Deviation Occurs

Fault Locating

The program is running properly, but the output is different from the expected result. Figure 1 shows how to locate and rectify the fault.

Figure 1 Fault locating for Fortran data deviation
  1. Confirm that data deviation occurs based on the command output.
  2. Streamline the calculation process where data deviation occurs.
  3. Analyze the possible causes, add the print information, and analyze the print result.
  4. Confirm the cause and modify the code. Then perform a verification.
  5. If the problem persists, check other possible causes.

Case: Data Deviation Caused by Uninitialized Arrays

Symptom

Some data in the software running result is inaccurate.

Fault Locating

  1. Confirm that the calculation result of the rad_clr7.3 table is inaccurate.
  2. Confirm that the error data range is [855,856;1190,1191]. Print key variables in the range. See the following figure:

  3. Compare the key variable values with the output.

  4. Check the calculation process. It is found that the tau array contains a large amount of abnormal data. It is possible that the data is dirty.

  5. Check the calling position of the tau array. It is found that the array is not initialized. Initialize the array.

  6. Modify the code and verify that the data deviation problem is resolved.