program rw implicit none character(20):: fn1,fn2 real(16), parameter:: pi26=3.1415926535897932384626434_16 real(16), parameter:: e26= 2.7182818284590452353602875_16 integer(8):: N real(16):: x16,d16,ref integer:: i,k,j,p(3) character(2):: prec character(3):: tst p=(/32, 64, 80/) do j=1,2 if(j==1) then tst="E_"; ref=e26 elseif(j==2) then tst="PI_"; ref=pi26 endif do i=1,3 !precision write(prec,'(i2)') p(i) fn1= trim(tst)//prec//".dat" fn2= trim(tst)//prec//"_err.dat" open(1,file=fn1,status='old') open(2,file=fn2) do !read end of the file read(1,*,end=11) k,N,x16 d16=(x16-ref)/ref if(i==1) write(2,*) k,N,real(x16,4), real(d16) if(i==2) write(2,*) k,N,real(x16,8), real(d16) if(i==3) write(2,*) k,N,real(x16,10), real(d16) enddo 11 continue close(1) close(2) enddo !i enddo !j end program