[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#121852: g77-3.0 fails to compute a complex log of certain values



Package: g77-3.0
Version: 1:3.0.2-3
Severity: normal


g77-3.0 fails to compute a complex log of certain values

computing log(x), for certain complex values of x (e.g. x=(1.00390625,0.) ) 
the fortran program enters a loop (no error, no core ... ), does not
compute the  value, and the program has to be killed (with Ctrl-C).

g77-2.95 can compute the value. 

Below there is a script session (together with the program) to reproduce
the bug. g77-2.95 runs the program fine, g77-3.0 doesn't

Best regards,

Jaume 


==================================================
Script started on Fri Nov 30 16:36:03 2001
jasi $ g77 --version
GNU Fortran 0.5.25 20010319 (prerelease)
Copyright (C) 1997 Free Software Foundation, Inc.
For more version information on components of the GNU Fortran
compilation system, especially useful when reporting bugs,
type the command `g77 --verbose'.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
or type the command `info -f g77 Copying'.
jasi $ gcc --version
2.95.4
jasi $ cat prova.F
      program prova
      implicit none
      double complex cs,x1,x2
      double precision precc,x0

      x0=0.d0
      precc = 0.01d0      
      print *,"precc,x0:",precc,x0
C     This is fine
      cs = exp(log(DCMPLX(1+precc,x0)))
      write(6,FMT=*), "cs=exp(log(1+precc))=",dble(cs)

      x0=0.d0
      precc = 0.001d0
      print *,"precc,x0:",precc,x0
      
C     This is fine
      cs = exp(log(DCMPLX(1+precc,x0)))
      write(6,*), "cs=exp(log(1+precc))=",dble(cs)

C     This value is not fine
      precc=0.00390625d0
      print *,"precc,x0:",precc,x0

      x1=DCMPLX(1+precc,x0)
      write(6,*) "x1=",x1
      x2=log(x1)
      write(6,*) "x2=log(x1)=",x2
      cs=exp(x2)      
      write(6,*), "cs=exp(x2)=",dble(cs)
      cs = exp(log(DCMPLX(1+precc,x0)))
      write(6,*), "cs=exp(log(1+precc))=",dble(cs)

      stop
      end

jasi $ g77 -o prova295 prova.F
jasi $ ./prova295
 precc,x0:  0.01  0.
 cs=exp(log(1+precc))=  1.01
 precc,x0:  0.001  0.
 cs=exp(log(1+precc))=  1.001
 precc,x0:  0.00390625  0.
 x1= (1.00390625,0.)
 x2=log(x1)= (0.00389864042,0.)
 cs=exp(x2)=  1.00390625
 cs=exp(log(1+precc))=  1.00390625
jasi $ g77-3.0 --version
GNU Fortran 0.5.26 20011023 (release)
Copyright (C) 2001 Free Software Foundation, Inc.
For more version information on components of the GNU Fortran
compilation system, especially useful when reporting bugs,
type the command `g77 --verbose'.

GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
or type the command `info -f g77 Copying'.
jasi $ gcc-2 3, .0 --version
3.0.2
jasi $ g77-3.0 -o prova3 prova.F
jasi $ ./prova3
 precc,x0:  0.01  0.
 cs=exp(log(1+precc))=  1.01
 precc,x0:  0.001  0.
 cs=exp(log(1+precc))=  1.001
 precc,x0:  0.00390625  0.
 x1= (1.00390625,0.)
Interrupt
jasi $ exit

Script done on Fri Nov 30 16:37:32 2001



-- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux jasi 2.4.14 #1 Sun Nov 18 18:19:45 CET 2001 i686
Locale: LANG=C, LC_CTYPE=

Versions of packages g77-3.0 depends on:
ii  gcc-3.0                       1:3.0.2-3  The GNU C compiler.
ii  gcc-3.0-base                  1:3.0.2-3  The GNU Compiler Collection (base 
ii  libc6                         2.2.4-5    GNU C Library: Shared libraries an




Reply to: