This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: single to double conversion


On Wed, Sep 27, 2006 at 07:40:23PM +0200, Tobias Burnus wrote:
> 
> With g77 I get (indeed):
> 42.4199982
> (Actually, also if I split the source files: g77 -c test1.f; g77 -c
> test2.f; g77 test*.o; yields 42.42. I really wonder what g77 is doing
> here. Swapping real*8 and real does also work.)
> 
> I don't know what g77 does, but
> (a) the result depends strongly on the compiler, actually of the 5
> compilers tested, only g77 got the intended result
> (b) g77 also crops the precision with  r8variable = 1.23456789 (without
> using "d0"). Probably the DEC compiler does as well.
> 

The author of g77 made the decide to use the f2c runtime library.
f2c always promotes a single precision function to double 
precision.  You are seeing the effects of that decision.  Tobi
implemented the -ff2c option for compatibility.

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]