Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fortran Floating point problem 1

Status
Not open for further replies.

mano46

Programmer
Jan 5, 2005
2
US
Hi All,

In my project, we had to migrate a few old Fortran codes from one server to another server. in that process, i am able to compile the Fortran code and create the executable file. but, i get a small error in the in the floating point numbers. I have tried to compile the codes in different ways. But am not able to succeed.

below is a small piece of the comparison between the outputs from both the servers.(just look at the last fp number)

Compare: (<) new_server_swtst.3o (115221 bytes)
with : (>) orig_server_swtst.3o (115221 bytes)

< ag 0.40934E-04 0.3708229293E-09
> ag 0.40934E-04 0.3708229117E-09

The new server to which we are moving the Fortran code is a "Sun Fire[tm] V880 Server" system and it uses the IEEE floating point system & and the old system is a "Sun Blade[tm] 150 Workstation". This is all that i know abt the systems.

& about the software package, it is a program called EQ3/6 that does a few chemical calculations. according to the documentation, it says "Portability to machines with odd word lengths (other than 16, 32, or 64 bits), or machines which lack compilers fully consistent with the FORTRAN 77 standard, may be quite difficult. " but, both of the servers have 128 bit word lengths. somehow they have installed it correctly in the older server.

both the servers have a GNU fortran 77 compiler. & the new server has a Sun's f77,f90 & f95 compiler.

I would be glad if anyone can help me out with this problem, as i am new to both Fortran and Unix server stuff.

Thanks
Manohar
(Software Developer, ASU SF)
 
Looks like the word length is 16. Check your compiler options. There may be something to set the word length. Alternatively, change all FLOAT calculations to DOUBLE PRECISION. Remember to change the format too.
 
Thanks for your help. But, i finally figured out the problem. Yes it was a compiler issue. i found from the Fortran user guide that there is an option called -xtypemap=real:64 . That was the only thing i was searching for all these days. it requires my program to be compiled as:

f77 -c -xtypemap=real:64 *.f

ar rc eq3nr.a *.o

ranlib eq3nr.a

f77 -xtypemap=real:64 -o eq3nr.exe eqlib.a eq3nr.a

& right now, my program is working fine and am pretty excited. Thanks again.


Thanks
Manohar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top