🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #1256

FORTRAN I/O (Was: Lessons from Algol)

#1256
From: Richard Conto
Date: Fri, 04 May 1990 17:07
49 lines
1932 bytes
In article <XT73_W7ggpc2@ficc.uu.net> peter@ficc.uu.net (Peter da Silva) writes:
>> With respect to the C statement:
>
>>      printf("The answer is %d, not %d\n", ans, resp)
>
>> one can use the following Fortran statement
>
>>      write(*,*)' The answer is',ans,' not',resp
>
>Will this not pad the numbers "ans" and "resp" with spaces? Fortran I/O is
>heavily oriented towards columnar output, to the extent that it's all but
>impossible to avoid this.
>-- 

Using the IBM FORTRANVS compiler (which is supposed to be FORTRAN-77 with
extensions) on the following program:

      PROGRAM TESTIO
      INTEGER I
      REAL Q
C
C
C
      DO 10 I=1,10
        Q = SQRT(I*1.0)
10      WRITE(*,*) ' SQRT(',I,') is ',Q
      END

I got the following output:

 SQRT(1,) is 1.,
 SQRT(2,) is 1.414213,
 SQRT(3,) is 1.732051,
 SQRT(4,) is 2.,
 SQRT(5,) is 2.236068,
 SQRT(6,) is 2.44949,
 SQRT(7,) is 2.645751,
 SQRT(8,) is 2.828427,
 SQRT(9,) is 3.,
 SQRT(10,) is 3.162277,

Our system's IO library (on MTS) seems to like stuffing ","s on the end of
numbers in WRITE statements like the above. Is this what the standard says?

--- Richard Conto
    rsc@merit.edu
    Richard_Conto@ummts.cc.umich.edu
    USERW014 at UMICHUM (bitnet)
    Richard_Conto@um.cc.umich.edu
Technical Details
Message-ID: <1990May4.170754.18659@terminator.cc.umich.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!umich!terminator!merit.edu!rsc
References: <1990Apr19.180903.27750@maths.nott.ac.uk> <4277@tukki.jyu.fi> <N+63FGBggpc2@ficc.uu.net> <14357@lambda.UUCP> <XT73_W7ggpc2@ficc.uu.net>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.misc
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!umich!terminator!merit.edu!rsc
From: rsc@merit.edu (Richard Conto)
Subject: FORTRAN I/O (Was: Lessons from Algol)
Message-ID: <1990May4.170754.18659@terminator.cc.umich.edu>
Keywords: FORTRAN
Sender: usenet@terminator.cc.umich.edu (usenet news)
Reply-To: Richard_Conto@ummts.cc.umich.edu (Richard Conto)
Organization: U of Michigan, Merit Network
References: <1990Apr19.180903.27750@maths.nott.ac.uk> <4277@tukki.jyu.fi> <N+63FGBggpc2@ficc.uu.net> <14357@lambda.UUCP> <XT73_W7ggpc2@ficc.uu.net>
Date: Fri, 4 May 90 17:07:54 GMT