From: Padiyath Kumar <Kumar.Padiyath@psi.ch>
Subject: Fortran (f90)
Date: Mon, 10 Mar 2003 16:16:31 +0100 [thread overview]
Message-ID: <ABC4EFAF3217D311A39200508B08F7FC04A94783@psi17.psi.ch> (raw)
Hello,
To-day I have received the following program from a user.
The program produces different results for dufferent formats.
The question is whether this is a compiler error or not.
On the VMS systems the program was producing correct
results(unfortunately we donot have
any more VMS systems).
regards,
Kumar
Programme DEMO
! **************
!
! Programme showing that we must avoid to use
! the FORMAT * , with the quadruple precision !!
!
Integer , Parameter :: qd = Kind(0.q0)
!
Real(qd) :: Pi,Qi
!
Character(80) :: c,d,e
!---------------------------------------------------------------------------
----
Pi = 4.q0*Atan(1.q0)
!
write(29,*) Pi ! Here ~ 2.7E-32
rewind(29)
read(29,*) Qi
write(c,*) Pi-Qi
rewind(29)
!
write(29,1) Pi ! Here ~ -0.4E-33
rewind(29)
read(29,1) Qi
write(d,1) Pi-Qi
rewind(29)
!
write(29,2) Pi ! Here 0 as it should !!
rewind(29)
read(29,2) Qi
write(e,2) Pi-Qi
!
write(*,'(//)')
write(*,'(a)') Trim(Adjustl(c))
write(*,'(a)') Trim(Adjustl(d))
write(*,'(a)') Trim(Adjustl(e))
write(*,'(//)')
!
1 format(g60.34)
2 format(g60.35) ! Good format
!
end programme DEMO
Output from Program:
===============
2.696301922142130194278369119618898E-0033
-0.3851859888774471706111955885169855E-33
0.0000000000000000000000000000000000
reply other threads:[~2003-03-10 15:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox