------- Comment #5 from fxcoudert at gcc dot gnu dot org  2007-10-01 23:28 
-------
Hum, the real(16) case looks like loads of fun to come!

$ cat k.f90
  integer, parameter :: k = 16
  character(80) :: buf
  real(k) :: xk, yk

  xk = 1.0_k - epsilon(xk)
  write (buf,'(1PG60.40)') xk
  read (buf,*) yk
  write (*,'(1PG60.40)') xk
  write (*,'(1PG60.40)') yk
  if (xk /= yk) print *, "Mismatch"
  print *

  xk = 1.0_k + epsilon(xk)
  write (buf,'(1PG60.40)') xk
  read (buf,*) yk
  write (*,'(1PG60.40)') xk
  write (*,'(1PG60.40)') yk
  if (xk /= yk) print *, "Mismatch"
  print *

  end
$ gfortran k.f90 && ./a.out
              1.9999999999999999999999999999999753481000    
              4.9303806576313237838233035330174139355000E-32
 Mismatch

              1.0000000000000000000000000000000246519000    
              1.0000000000000000000000000000000246519000    

(Also, in the case of real(16), you need to add an E4 to the format anyway.)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33469

Reply via email to