CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Main CFD Forum (https://www.cfd-online.com/Forums/main/)
-   -   f77-g77 (https://www.cfd-online.com/Forums/main/7506-f77-g77.html)

subhra May 4, 2004 15:50

f77-g77
 
I found that the f77 and g77 compilers values differing in precison from 8th digit..any idea why?

Steve May 5, 2004 04:46

Re: f77-g77
 
From your question, my assumptions are:

1) You are using Linux. 2) You have a choice between 2 compilers, one of which is a proprietary FORTRAN compiler (e.g. from Absoft). The other is the native g77.

If this is the case, you are bound to get different results, since g77 is a wrapper around f2c and as such, isn't really a FORTRAN compiler at all.

One thing you'll find when using f2c to convert/compile FORTRAN code is that the order of evaluation changes. This can affect precision. Also in expressions like:

IF(A .and. B)

expression B will always be evaluated with a FORTRAN compiler, but only if A is true if you use f2c.

- Steve

jason May 6, 2004 13:28

Re: f77-g77
 
Your information on g77 is old. It is a front-end to gcc:

http://gcc.gnu.org/onlinedocs/g77/Wh...-Fortran-.html

This does not mean that the f2c stuff is totally gone, but g77 is *not* just a wrapper around f2c.

jason

dattsub May 7, 2004 18:27

f77-g77
 
Thanks for comments to both of you...I had run 1000s of iterations of my research code using g77...Perhaphs, I could have done better with a proprietery compiler....but I will broach another apparantly significant observation in the next message..it's not only the compiler..

jasond May 8, 2004 13:29

Re: f77-g77
 
Since I did not originally say anything about your issue, I'll do that now. Different compilers do different things with the precision of constants - for example, if I want a double precision value for pi I could do something like:

pi=acos(-1.0)

This will probably give different results using different compilers (proprietary or not). It probably shouldn't, but it does (and I am not sure what the standard says about this). There are usually switches that control what exactly is done with the "1.0" as an argument (is it a double or a single?). G77 is somewhat vulenerable to this issue, but it is not the worst I have seen.

jason


All times are GMT -4. The time now is 09:17.