tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* Fortran (f90)
@ 2003-03-10 15:16 Padiyath Kumar
  0 siblings, 0 replies; only message in thread
From: Padiyath Kumar @ 2003-03-10 15:16 UTC (permalink / 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-03-10 15:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-10 15:16 Fortran (f90) Padiyath Kumar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox