NCEP CCS Conversion Guide |
Issues Converting FORTRAN and C/C++ Programs |
Back to Main Page |
Topic: Floating Point Truncation/Rounding Differences | |||
Posted by: Stephen Gilbert
Updated by: |
Post Date: 12/06/2002
Last Updated: |
||
Problem: FORTRAN Programs that
were compiled on asp/bsp without the "-qarch=auto", "-qarch=604" or "-qarch=pwr3"
option were, by default, compiled with "-qarch=com" which forces all floating point calculations to be performed with 64-bit precision. The resulting values are truncated down to 32-bit floating point values when stored in a four byte real variable.
On Snow/Frost the default compiler option "-qarch=auto" is used, which
takes advantage of hardware to
Solution:
Caveats: Example:
Consider the following Fortran statement intended to combine the year,
month, day and hour into
The 1E6, 1E4 and 1E2 real constants force this calculation to be done using
floating point arithmetic. If this
|
Back to Main Page |