https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

--- Comment #3 from dpozar at ecs dot umass.edu ---
Thomas,

compile time works fine; runtime not so good.
dave

Output below:
 Runtime
          Argument                         SquareRoot                          
   SR squared
(-.1000E+02  0.1000E+00)   (0.1581E-01  0.3163E+01)   (-.1001E+02  0.1000E+00)
(-.1000E+03  0.1000E+00)   (0.5167E-02  0.9676E+01)   (-.9362E+02  0.1000E+00)
(-.1000E+04  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+05  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+06  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+07  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+08  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+09  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
(-.1000E+10  0.1000E+00)   (0.0000E+00    Infinity)   ( -Infinity         NaN)
 Compile-time
(-.1000E+02  0.1000E+01)   (0.1579E+00  0.3166E+01)   (-.1000E+02  0.1000E+01)
(-.1000E+03  0.1000E+01)   (0.5000E-01  0.1000E+02)   (-.1000E+03  0.1000E+01)
(-.1000E+04  0.1000E+01)   (0.1581E-01  0.3162E+02)   (-.1000E+04  0.1000E+01)
(-.1000E+05  0.1000E+01)   (0.5000E-02  0.1000E+03)   (-.1000E+05  0.1000E+01)
(-.1000E+06  0.1000E+01)   (0.1581E-02  0.3162E+03)   (-.1000E+06  0.1000E+01)
(-.1000E+07  0.1000E+01)   (0.5000E-03  0.1000E+04)   (-.1000E+07  0.1000E+01)
(-.1000E+08  0.1000E+01)   (0.1581E-03  0.3162E+04)   (-.1000E+08  0.1000E+01)
(-.1000E+09  0.1000E+01)   (0.5000E-04  0.1000E+05)   (-.1000E+09  0.1000E+01)
(-.1000E+10  0.1000E+01)   (0.1581E-04  0.3162E+05)   (-.1000E+10  0.1000E+01)

Process returned 0 (0x0)   execution time : 0.060 s
Press any key to continue.


________________________________
From: tkoenig at gcc dot gnu.org <gcc-bugzi...@gcc.gnu.org>
Sent: Tuesday, December 8, 2020 10:34 AM
To: David Pozar <dpo...@ecs.umass.edu>
Subject: [Bug fortran/98201] CSQRT function gives bad resuts at runtime

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98201

Thomas Koenig <tkoenig at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |mingw
                 CC|                            |tkoenig at gcc dot gnu.org

--- Comment #1 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Here is a slight extension of your program, which also
checks the compile-time simplification. Can you tell me
what it does?

program main
  implicit none
  integer :: i,n
  complex z, sq
  complex, parameter, dimension(9) :: zp = [(-10.**i+(0.,1.),i=1,9)]
  complex, parameter, dimension(9) :: sqp = sqrt(zp)
  write (*,*) "Runtime"
  write (*,*) "         Argument                SquareRoot               SR
squared"
  do n=1,9
     z=-10.**n+(0.,.1)
     sq=csqrt(z)
     write(*,1) z, sq, sq*sq
  end do
  write (*,*) "Compile-time"
  do n=1,9
    write (*,1) zp(n), sqp(n), sqp(n)**2
  end do
1 format(3("(",e10.4,2x,e10.4,")",3x))
end

On my Linux box, it prints

 Runtime
          Argument                SquareRoot               SR squared
(-.1000E+02  0.1000E+00)   (0.1581E-01  0.3162E+01)   (-.1000E+02  0.1000E+00)
(-.1000E+03  0.1000E+00)   (0.5000E-02  0.1000E+02)   (-.1000E+03  0.1000E+00)
(-.1000E+04  0.1000E+00)   (0.1581E-02  0.3162E+02)   (-.1000E+04  0.1000E+00)
(-.1000E+05  0.1000E+00)   (0.5000E-03  0.1000E+03)   (-.1000E+05  0.1000E+00)
(-.1000E+06  0.1000E+00)   (0.1581E-03  0.3162E+03)   (-.1000E+06  0.1000E+00)
(-.1000E+07  0.1000E+00)   (0.5000E-04  0.1000E+04)   (-.1000E+07  0.1000E+00)
(-.1000E+08  0.1000E+00)   (0.1581E-04  0.3162E+04)   (-.1000E+08  0.1000E+00)
(-.1000E+09  0.1000E+00)   (0.5000E-05  0.1000E+05)   (-.1000E+09  0.1000E+00)
(-.1000E+10  0.1000E+00)   (0.1581E-05  0.3162E+05)   (-.1000E+10  0.1000E+00)
 Compile-time
(-.1000E+02  0.1000E+01)   (0.1579E+00  0.3166E+01)   (-.1000E+02  0.1000E+01)
(-.1000E+03  0.1000E+01)   (0.5000E-01  0.1000E+02)   (-.1000E+03  0.1000E+01)
(-.1000E+04  0.1000E+01)   (0.1581E-01  0.3162E+02)   (-.1000E+04  0.1000E+01)
(-.1000E+05  0.1000E+01)   (0.5000E-02  0.1000E+03)   (-.1000E+05  0.1000E+01)
(-.1000E+06  0.1000E+01)   (0.1581E-02  0.3162E+03)   (-.1000E+06  0.1000E+01)
(-.1000E+07  0.1000E+01)   (0.5000E-03  0.1000E+04)   (-.1000E+07  0.1000E+01)
(-.1000E+08  0.1000E+01)   (0.1581E-03  0.3162E+04)   (-.1000E+08  0.1000E+01)
(-.1000E+09  0.1000E+01)   (0.5000E-04  0.1000E+05)   (-.1000E+09  0.1000E+01)
(-.1000E+10  0.1000E+01)   (0.1581E-04  0.3162E+05)   (-.1000E+10  0.1000E+01)

so there is a slight difference in one value, but nothing as
completely wrong as what you show.

What is the output of that program on your system?

And what is the output of "gfortran -v" ?

--
You are receiving this mail because:
You reported the bug.

Reply via email to