Hi - We noticed some code was very slow in gfortran vs g77, almost a factor of 7 times slower. This appears to be because gfortran uses the expf liubrary function call for the fortran exp() function for single precision numbers, but g77 uses the exp library function (i.e. the double precision function).
You can see the very large speed differences by telling gfortran to always use double precision numbers. This can be replicated with this simple program: test.f: implicit none integer i,j real a, u do j=1,10 do i=1,10000000 a=exp(1.0+1.0/i) u = u+a end do end do print *,u end Compiled with gfortran -O2: real 0m29.921s user 0m29.912s sys 0m0.000s Compiled with gfortran -O2 -fdefault-real-8: real 0m4.306s user 0m4.304s sys 0m0.000s This is with a newly built gcc 4.4.1 on Fedora 10 (glibc 2.9), x86-64. As the difference comes down to the speed difference between exp and expf, is it a gcc issue or a glibc issue? Should gcc be using this slow function? It seems amazing that the same function call is 7 times slower for lower precision numbers! Thanks Jeremy -- Jeremy Sanders <j...@ast.cam.ac.uk> http://www-xray.ast.cam.ac.uk/~jss/ X-Ray Group, Institute of Astronomy, University of Cambridge, UK. Public Key Server PGP Key ID: E1AAE053