[Discuss] Test for positive gives wacko results for underflowed values for the gcc compiler suite (including the gcc compiler, and g77 and gfortran compilers)

pw p.willis at telus.net
Mon Jun 25 14:24:03 PDT 2007


Alan W. Irwin wrote:
>
> Anybody have a clue about what is going on here between the bad results for
> fortran and C on the one hand and good results for python on the other?
> 
> Is this a gcc (and g77 and gfortran) issue?  I would appreciate it if
> somebody would run the above C test codes with different C
> compilers/platforms.
 >

Setting the precision back to IEEE 754 single precision gives a
different answer.


       DOUBLE PRECISION x, xscale
       x = 1.d-126
       xscale = 1.d+127
       write(*,'(1p3d15.5)') x, xscale, x/xscale
       write(*,*) x/xscale.gt.0.d0
       write(*,*) x/xscale.gt.1.d-305
       write(*,*) log(x/xscale)
       end


test.exe

     1.00000-126    1.00000+127    1.00000-253
  T
  T
   -582.554028527494



Looks like somebody has mixed up 'float' and 'double' definitions
somewhere for this build.

What happens if gcc gets rolled back to a previous version?

Peter



More information about the Discuss mailing list