Previous: plot Up: ../plot79.html Next: plot79_c

SUBROUTINE ABSFA (ARRAY,LENGTH,FILL) C$ (Fill Array) C$ Fill 'LENGTH' elements of 'ARRAY(*)' with the value 'FILL'. C$ (02-FEB-82)

SUBROUTINE ABSMA (IOINDX,IOREAD,IOABS,LCPAGE) C$ (Abstract Main Routine) C$ This program provides an abstract listing of a distribution C$ tape <PLOT79> file. The input file, IOREAD, is assumed to C$ contain the <PLOT79> routines in alphabetical order, C$ separated by C$ C$ ./ ADD NAME=XXXXXX C$ C$ cards. The output file, IOABS, will contain the C$ SUBROUTINE/FUNCTION/PROGRAM statements, followed by those C$ comments which precede the first FORTRAN statement. These C$ are written in a print-file format with page headers and C$ footers. Member names and their corresponding page numbers C$ are saved on a scratch file, IOINDX, and used to construct C$ an index to the listing when end-of-file is reached on the C$ input file. The arguments are: C$ C$ IOINDX......Scratch file for developing the index. C$ IOREAD......Input file containing the plot system. C$ IOABS.......Output print file containing the abstracts as C$ 80-character records containing a C$ carriage-control character in column 1. C$ LCPAGE......Number of lines/page (suggested value = 58). C$ C$ The coding is entirely in Portable FORTRAN, with the C$ exception of a non-standard end-of-file check in SUBROUTINE C$ ABSRC, plus lower-case letters in FORMATs in ABSNP, and C$ lower-case letters in FORMATs and comment statements, and C$ in Hollerith constants in ABSWI. C$ C$ (02-FEB-82)

SUBROUTINE ABSNP (IOABS,LN,LC,PN) C$ (New Page) C$ Write a page footer and start a new page with a page C$ header. C$ (04-Mar-1991)

SUBROUTINE ABSRC (IOREAD,CARD,EOFILE) C$ (Read Card) C$ Read an 80-character card image from file 'IOREAD', C$ returning it in A1-FORMAT in 'CARD(*)', with 'EOFILE' set C$ .TRUE. at end-of-file. C$ (07-JUL-81)

INTEGER FUNCTION ABSSL (STRING,MAXSTR) C$ (String Length) C$ Return the length of the A1-FORMAT text in STRING(*) after C$ trimming trailing blanks. The first blank is not counted, C$ so that on return, ABSSL is not less than 1. C$ (07-JUL-81)

SUBROUTINE ABSWC (IOABS,CARD,MAXCRD,LN,LC,PN) C$ (Write Card) C$ Write 'CARD(MAXCRD)' to file 'IOABS', trimming trailing C$ blanks, and updating the line number and page number. C$ (07-JUL-81)

SUBROUTINE ABSWI (IOABS,NAME,LN,LC,PN,IOINDX,EOF) C$ (Write Index) C$ Read entries from the index file, IOINDX, and write the C$ index to the abstract file, IOABS. The parenthesized C$ mnemonic phrase describing the routine is recorded on the C$ index line if there is space. The index line is followed C$ by the routine header statement. Index entries are not C$ permitted to be split across page boundaries. On C$ completion of the index, a title page is written. C$ (02-FEB-82)

SUBROUTINE ABSWT (IOABS,NAME,LN,LC,PN,IOINDX) C$ (Write Title in Box) C$ Write 'NAME(6)' in a box on the listing file, 'IOABS', C$ updating the page number and line number. An entry is also C$ made to the index file. C$ (07-JUL-81)

REAL FUNCTION ACOS (X) C$ (Arc Cosine) C$ The arc cosine function is not defined in the 1966 FORTRAN C$ Standard, although most manufacturers have implemented it C$ under the name ARCOS or ACOS. The 1977 FORTRAN Standard C$ includes it as the function ACOS. This routine computes C$ the function from ASIN, which is computed for a real C$ argument X to machine-precision using a rapidly-convergent C$ Taylor series expansion taken from M. Abramowitz and I.A. C$ Stegun, Handbook of Mathematical Functions, NBS Applied C$ Mathematics Series No. 55, U.S. National Bureau of C$ Standards, (1964), formulas 4.4.40 and 4.4.41. C$ C$ The argument reduction for ABS(X) in the range 0.5..1.0 is C$ done carefully to avoid accuracy loss, as recommended by C$ W.J. Cody, Jr. and W. Waite, "Software Manual for the C$ Elementary Functions", Prentice-Hall, NJ (1980), p. 182. C$ In particular, the constant pi/2, which has 3 leading zero C$ bits on machines with hexadecimal normalization (e.g. IBM C$ 370), is represented as 4*pi/8, where 4*pi has no leading C$ zero bits. C$ C$ The ELEFUNT tests of Cody and Waite have been made on the C$ DEC-20/60, with the following results: C$ C$ abs(x) in 0 .. 1/8 - maximum relative error: 0.47 bits lost C$ - RMS relative error: 0.00 bits lost C$ abs(x) in 3/4 .. 1 - maximum relative error: 2.07 bits lost C$ - RMS relative error: 0.14 bits lost C$ (04-SEP-82)

REAL FUNCTION ASIN (X) C$ (Arc Sine) C$ The arc sine function is not defined in the 1966 FORTRAN C$ Standard, although most manufacturers have implemented it C$ under the name ARSIN or ASIN. The 1977 FORTRAN Standard C$ includes it as the function ASIN. This routine computes C$ the function to machine-precision for a real argument X C$ using a rapidly-convergent Taylor series expansion taken C$ from M. Abramowitz and I.A. Stegun, Handbook of C$ Mathematical Functions, NBS Applied Mathematics Series No. C$ 55, U.S. National Bureau of Standards, (1964), formulas C$ 4.4.40 and 4.4.41. C$ C$ The argument reduction for ABS(X) in the range 0.5..1.0 is C$ done carefully to avoid accuracy loss, as recommended by C$ W.J. Cody, Jr. and W. Waite, "Software Manual for the C$ Elementary Functions", Prentice-Hall, NJ (1980), p. 182. C$ In particular, the constant pi/2, which has 3 leading zero C$ bits on machines with hexadecimal normalization (e.g. IBM C$ 370), is represented as 4*pi/8, where 4*pi has no leading C$ zero bits. C$ C$ The ELEFUNT tests of Cody and Waite have been made on the C$ DEC-20/60, with the following results: C$ C$ abs(x) in 0 .. 1/8 - maximum relative error: 1.00 bits lost C$ - RMS relative error: 0.00 bits lost C$ abs(x) in 3/4 .. 1 - maximum relative error: 2.24 bits lost C$ - RMS relative error: 0.00 bits lost C$ (04-SEP-82)

REAL FUNCTION ATAN2 (Y,X) C$ (Arctangent) C$ Return the arctangent of Y/X. Although this is a standard C$ FORTRAN function, neither the 1966 nor the 1977 Standards C$ define the range of function values. It is customary, and C$ required by <PLOT79>, to return values in the range C$ -pi..+pi. This is in fact the case for CDC, IBM, DEC, and C$ UNIVAC implementations, but on some smaller machines, C$ ranges such as 0..2*pi or -pi/2..+pi/2 may be encountered. C$ The following code implements the special case handling C$ required to reduce the function computation either to a C$ constant value, or to a reference to ATAN(Y/X). It is C$ based upon the algorithm used in the IBM ATAN2 function, as C$ described in the publication: C$ C$ IBM System/360 Operating System C$ FORTRAN IV Library -- C$ Mathematical and Service Subprograms C$ Order No. GC28-6818 C$ C$ The value of ATAN2(0,0) is in principle undefined, and on C$ CDC machines, a hardware representation of 0/0 is returned. C$ This is undesirable, and this version returns pi/2, just as C$ for any other call to ATAN2(Y,0). C$ C$ The algorithm has been slightly modified to avoid the use C$ of machine-dependent constants; values for multiples of pi C$ are coded as DOUBLE PRECISION constants in a DATA statement C$ below, and should be sufficiently accurate for all existing C$ architectures. C$ C$ A caveat should be issued here. Experience has shown that C$ host implementations of the ATAN function are sometimes C$ woefully inaccurate, and it may be necessary to provide a C$ private replacement version of ATAN. C$ C$ (02-APR-82)