Fortran_Extended_4_Ref_Man_60497800J_Jun83 Fortran Extended 4 Ref Man 60497800J Jun83
Fortran_Extended_4_Ref_Man_60497800J_Jun83 Fortran_Extended_4_Ref_Man_60497800J_Jun83
User Manual: Pdf Fortran_Extended_4_Ref_Man_60497800J_Jun83
Open the PDF directly: View PDF .
Page Count: 546
Download | |
Open PDF In Browser | View PDF |
60497800 CONTROL DATA CORPORATION /ff^y FORTRAN EXTENDED VERSION 4 REFERENCE MANUAL r C D C ® O P E R AT I N G S Y S T E M S : NOS 1 NOS 2 NOS/BE 1 SCOPE 2 /f*3S*j\ REVISION RECORD Revision Description A (11/01/75) Original release. B (03/05/76) This revision documents Version 4.6 of FORTRAN Extended. Features documented include CP155, Compiler Enhancements, and CP079, Math Library Upgrade. C (04/15/77) Revised to include feature F7540, CYBER 170 Model 176 Support, as well as miscellaneous technical corrections, at PSR level 446. 0 (03/31/78) This revision documents Version 4.7 of FORTRAN Extended. Features documented include CP091 and CP162, CRM products BAM and AAM, 191, Math Library Upgrade, CP184, Fast Overlay Loading, and 66, CYBER Interactive Debug interface. Also documented is the implementa tion of STATIC mode memory management, as well as miscellaneous technical changes and corrections. E (07/20/79) This revision documents Version 4.8 of FORTRAN Extended. The Post Mortem Dump facility is documented with this release, as well as numerous technical changes. F (08/22/80) This revision documents changes to Post Mortem Dump, adds the FORTRAN Interface to Common Memory Manager, and adds the STATIC option to FORTRAN Extended. Numerous technical changes are included. PSR level 524. G (01/15/81) This revision documents release of Post Mortem Dump and STATIC option under SCOPE 2. Numerous technical changes are included. PSR level 533. H (08/13/82) This revision documents numerous technical changes and corrections. PSR level 552. J (06/10/83) This revision documents numerous technical and editorial corrections. PSR level 577. REVISION LETTERS I, 0, Q, AND X ARE NOT USED ©COPYRIGHT CONTROL DATACORPORATION 1975, 1976, 1977, 1978, 1979, 1980, 1981, 1982, 1983 All Rights Reserved Printed in the United States of America n Address comments concerning this manual to: CONTROLDATACORPORATION Publications and Graphics Division P. 0. BOX 3492 SUNNYVALE, CALIFORNIA 94088-3492 or use Comment Sheet in the back of this manual 60497800 J LIST OF EFFECTIVE PAGES J0B&K, New features, as well as changes, deletions, and additions to information in this manual are indicated by bars in the margins or by a dot near the page number if the entire page is affected. A bar by the page number indicates pagination rather than content has changed. Page ijfpSN Revision Front Cover Inside Front Cover Title Page ii iii iv v vi d vii/viii ix X xi xii 1-1 thru 1-4 1-5 /*$RN /0S\ 1-6 thru 1-9 1-10 1-11 thru 1-17 2-1 2-2 2-3 2-4 2-5 2-6 2-7 thru 2-20 3-1 thru 3-9 3-10 3-11 3-12 3-13 3-14 3-15 3-16 3-17 3-18 3-19 3-20 3-21 4-1 4-2 4-3 4-4 4-5 thru 4-9 4-10 4-11 4-12 4-13 4-14 thru 4-16 5-1 5-2 5-3 5-4 thru 5-6 r 5-7 5-8 5-9 5-10 5-10.1 5-10.2 60497800 J J Page 5-11 thru 5-■19 5-20 5-21 5-22 5-23 5-24 5-25 thru 5-■28 6-1 6-2 6-3 6-4 6-5 6-6 thru (5-8 6-9 6-10 6-11 thru 6-■17 6-18 6-18.1/6-18.2 6-19 thru 6-■21 6-22 6-23 6-24 6-25 thru 6- 27 6-28 6-29 6-30 6-31 6-32 6-33 6-34 6-35 thru 6- 37 7-1 7-2 7-3 7-4 7-5 thru 7-S 7-10 7-11 7-12 7-13 thru 7- 15 7-16 7-17 7-18 7-19 7-20 7-21 7-22 7-23 7-24 thru 7-28 8-1 8-2 8-3 8-4 8-5 8-6 8-6.1/8-6.2 Revision Page Revision 8-7 8-8 8-9 8-10 8-11 thru 8-16 8-16.1/8-16.2 8-17 8-18 8-19 8-20 8-21 8-22 8-23 8-24 8-25 8-26 8-26.1/8-26.2 8-27 8-28 8-29 8-30 8-31 8-32 8-32.1 /8-32.2 8-33 thru 8-35 8-36 8-37 8-38 8-39 8-40 8-41 8-42 8-43 8-44 8-45 thru 8-47 8-48 thru 8-51 8-52 8-53 8-54 8-55 8-56 8-56.1/8-56.2 8-57 thru 8-61 9-1 9-2 thru 9-4 9-5 9-6 9-7 9-8 9-9 9-10 9-11 thru 9-29 10-1 10-2 10-3 10-4 iii • Revision 10-5 thru 10-7 10-8 10-9 10-10 11-1 11-2 11-3 11-4 11-5 11-6 11-7 12-1 12-2 12-3 12-4 12-5 13-1 13-2 13-3 13-4 13-5 thru 13-8 13-9 13-10 13-11 13-12 13-13 13-14 13-15 13-16 thru 13-20 13-21 14-1 14-2 14-3 15-1 thru 15-3 16-1 16-2 16-3 16-4 16-5 16-6 16-7 16-8 16-9 16-10 16-11 16-12 16-13 ' 17-1 17-2 17-3 17-4 17-5 17-6 18-1 18-2 thru 18-6 18-7 18-8 18-9 thru 18-11 19-1 19-2 19-3 19-4 thru 19-7 19-8 19-9 thru 19-11 19-12 19-13 thru 19-18 19-19 19-20 thru 19-27 .19-28 19-29 thru 19-32 19-33 19-34 • IV Page 20-1 A-l A-2 A-3 B-l thru B-4 B-5 B-6 B-7 B-8 B-9 B-10 B-ll thru B-14 B-15 B-16 B-17 B-18 B-19 B-20 B-21 B-22 B-23 thru B-26 B-27 B-28 B-29 B-30 B-31 thru B-33 B-34 B-35 B-36 B-37 B-38 thru B-41 B-42 B-43 B-44 thru B-49 B-50 B-51 thru B-64 B-65 B-66 B-67 B-68 B-69 thru B-76 B-77 B-78 B-79 B-80 B-81 B-82 B-83 B-84 B-85 B-86 B-87 B-88 B-89 B-90 B-91 B-92 B-93 B-94 B-95 B-96 B-97 C-l thru C-8 C-9 thru C-ll D-l D-2 D-3 thru D-5 D-6 D-7 D-8 E-l thru E-6 Index-1 Revision Page Revision Index-2 Index-3 Index-4 Index-5 Index-6 Comment Sheet Mailer Back Cover yfS&Sv .■**^^\ 60497800 J /<*^j. PREFACE f This manual describes the FORTRAN Extended 4.8 language. FORTRAN Extended is designed to comply with American National Standards Institute FORTRAN language, as described in X3.9-1966. It is assumed the reader has knowledge of an existing FORTRAN language and is familiar with the computer system on which the /^^ language is used. The FORTRAN Extended compiler operates in conjunction with the COMPASS 3 assembly language processor ^p^ under control of the following operating systems: NOS 1 for the CONTROL DATA® CYBER 170 Series, CYBER 70 Models 71, 72, 73, 74, and 6000 Series | Computer Systems NOS 2 for the CDC® CYBER 170 Series, CYBER 70 Models 71, 72, 73, 74, and 6000 Series Computer | Systems 0s\ NOS/BE 1 for the CDC CYBER 170 Series, CYBER 70 Models 71, 72, 73, 74, and 6000 Series Computer | Systems /^ SCOPE 2 for the CONTROL DATA CYBER 170 Model 176, CYBER 70 Model 76, and 7600 Computer Systems All references in this manual to NOS 1 refer to both NOS 1 and NOS 2. Due to capsule loading, relocatable binaries compiled by versions of FORTRAN Extended prior to version 4.7 cannot be run with CRM BAM 1.5 or AAM 2; they must be recompiled. Control Data extensions to the FORTRAN language are indicated by shading. Example programs or parts of programs are shaded in their entirety if they contain lines using extensions to the ANSI standard (unless the only such extension is the PROGRAM statement). Shading is used only in sections 1 through 8, which contain the /*"5Rx f specification of the FORTRAN Extended language; later sections describe the implementation of these specifications and shading is not used. r Extended memory extendedfor (LCME). the CYBER Extended 170 memory Modelfor176 theis CYBER large central 170 800memory Series Computer (LCM) or Systems large central is unifiedmemory extended memory (UEM). Extended memory for all other NOS or NOS/BE computer systems is extended core storage (ECS) or extended semiconductor memory (ESM). In this manual, the acronym ECS refers to all forms of 0^ extended memory unless otherwise noted. Programming information for the various forms of extended memory can be found in the COMPASS reference manual and in the appropriate computer system hardware reference manual. \. Related material is contained in the listed publications. These publications are listed alphabetically and grouped according to their importance to the FORTRAN user. The NOS 1, NOS 2, and NOS/BE 1 manual abstracts are pocket-sized manuals containing brief descriptions of the contents and intended audience of all {■^ operating system and product set manuals. The abstracts manuals can be useful in determining which manuals are of greatest interest to a particular user. documentation to the Programming System Report (PSR) of installed rThe Software Publicationscorresponds Release History is a guide for determining whichlevel revision levelsite of software. software /*"fSS /^n 60497800 J The following publications are of primary interest: Publication Publication Number NOS1 NOS 2 NOS/BE 1 SCOPE 2 FORTRAN Common Library Mathematical Routines Reference Manual 60498200 X X FORTRAN Extended Version 4 DEBUG User's Guide 60498000 X X FORTRAN Extended Version 4 User's Guide 60499700 X X NOS Version 1 Reference Manual Volume 1 of 2 60435400 NOS Version 2 Reference Set Volume 3, System Commands 60459680 X NOS/BE Version 1 Reference Manual 60493800 0£&$$\ X SCOPE Version 2 Reference Manual 60342600 X The following publications are of secondary interest: Publication Publication Number NOS1 NOS 2 NOS/BE 1 SCOPE 2 Common Memory Manager Version 1 Reference Manual 60499200 X X COMPASS Version 3 Reference Manual 60492600 X X CYBER Interactive Debug Version 1 Reference Manual 60481400 X X CYBER Interactive Debug Version 1 Guide for Users of FORTRAN Extended Version 4 60482700 X X CYBER Loader Version 1 Reference Manual 60429800 X X CYBER Record Manager Advanced Access Methods Version 2 Reference Manual 60499300 CYBER Record Manager Advanced Access Methods Version 2 User's Guide 60499400 VI .y^ V 9-27 9-28 10. FTN CONTROL STATEMENT 10-1 Parameters A Exit Parameter B Binary Object File BL Burstable Listing C COMPASS Assembly CC Control Statement Continuation Parameter D Debugging Mode Parameter DB CYBER Interactive Debug Parameter E Editing Parameter EL Error Level 10-1 10-2 10-2 10-2 10-2 10-2 10-3 10-3 10-3 10-4 60497800 J /«"»fe\ Xll 60497800 H FORTRAN LANGUAGE ELEMENTS A FORTRAN program contains executable and non-executable statements. Executable statements specify actions the program is to take, and non-executable statements describe characteristics of operands, statement functions, arrangement of data, and format of data. CODING FORTRAN STATEMENTS The FORTRAN source program is written on the coding form illustrated in figure 1-1. Each line on the coding form represents an 80-column source line (terminal line or card image). The FORTRAN character set is used to code statements. FORTRAN CHARACTER SET Alphabetic Numeric Special A to Z 0 to 9 = equal + plus - minus * asterisk / slash (left parenthesis ) right parenthesis , comma . decimal point $ dollar sign blank •£ or " quote In addition, any character (Appendix A) may be used in Hollerith constants and in comments. Blanks are not significant except in Hollerith fields. COLUMN USAGE Column 1 C or $ or * indicates comment line Columns 1-2 C$ indicates a debug directive if In DEBUG mode. Columns 1-2 C/ indicates a list directive. Columns 1-5 Statement label. Column 6 Any character other than blank or zero denotes continuation; does not apply to comment lines or list directives. A debug continuation line must contain C$ in columns 1-2. Columns 7-72 Statement. Columns 73-80 Identification field, not processed by compiler. Can contain information for debug AREA directive. /*SS\ 60497800 A 1-1 ,-sS^v / ^ ^ V j tc « ta tc S Ul 3 S S is » s te r- ^$*\ s 3 M I < 5 10 s 3 3 8 S S 8 8 S fi fi S IN lil 8 a a K 8 ID t-l i"- l - 3 3 X < S a <^*fi$\ a s ■i s V **2 »•* *• CO V *• f- z Ul £ B to h k f eo Ul O Ui s ca SC f IL 2 8 8 1 a o < o < < u .£ Z -1 o < •■ ?! 8 R 8 t- 8 S a a a cu a £ 3 •J) "2 8 5 < IN 8 8 .- •a 1 ^ - z .n" . "5 oa /*■» ■ST S" o o i a S Vw '-5 j »'/■■;*• •*+ * 1 N < a • ota. ■i -SS Ui *>» 1 ,/t^^v .- ~ -4 61 •a i-i tv i i .in T i tfl- o o z t-= iT IS) M • ri »— it < "■<» o .- Lo ■ y± a ■^ 1 "5 F ii .*2 . Z H '■ Oi 13 a cv •5 a. UJ 01 ID s▶*■ .— fesz. f > tu 111 1-2 cvt "2 •o 60497800 A /fl^sv 0S\ COMMENTS ^^ In column I a C, *, or $ indicates a comment line. Comments do not affect the program; they can be written in column 2 to 80 and can be placed anywhere within the program. If a comment occupies more than one line, each line must begin with C, *, or $ in column 1. In a comment line a character in column 6 /^ is not recognized as a continuation character. Comments can appear between continuation lines; they do not interrupt the statement continuation. /^ Comment lines following an END line are listed at the beginning of the next program unit unless the END line is continued. f S TAT E M E N T LABELS A statement label (any 1- to 5-digit integer) uniquely identifies a statement so it can be referenced by ^^ another statement. Statements that will not be referenced do not need labels. Blanks and leading zeros are not significant. Labels need not occur in numerical order; however, a given label must not be used more than once in the same program unit. A label is known only in the program unit containing it; it cannot be refer/^ enced from a different program unit. Any statement can be labeled, but only FORMAT and executable state ment labels can be referenced by other statements. A label on a continuation line is ignored. CONTINUATION Statements are coded in columns 7-72. If a statement is longer than 66 columns, it can be continued on as many as 19 continuation lines. A character other than blank or zero in column 6 indicates a continuation line. Column 1 can contain any character other than C, *, or $; columns 2, 3, 4, and 5 can contain any character. Any statement except a comment or a list directive can be continued, including the END statement. COLUMNS 73-80 Any information can appear in columns 73-80 because they are not part of the statement. Entries in these columns are copied to the source program listing. They are generally used to order the lines in a deck, but can contain information for DEBUG AREA processing. STATEMENT SEPARATOR Several statements can be written on one line if they are separated by the special character $. Each state ment following a $ sign is treated as a separate statement. For example: /fSV ACUM=24.$I=0 $ IDIFF-1970-1626 is the same as ACUM =. 24. I -.'0' IDIFP = 1970-1626 /fp**» $ can be used following any statement except FORMAT statements or list and debug directives. The state ment following $ cannot be labeled; the information following $ is treated exactly as if it were in column 7 on the next line. /(PS, 60497800 A 1-3 BLANK LINES Blank lines can be used freely between statements to produce blank lines on the source listing. Unlike a comment line; a blank line interrupts statement continuation, and the line following the blank line is the be ginning of a new statement. This line can optionally have the form of a continuation line. ^^s DATA /""^v No restrictions are imposed on the format of data read by the source program. Data input on cards is limited to 80 characters per card, but a record can span more than one card. The maximum length in characters for formatted, list directed, and NAMELIST records must agree with the length, r, specified in the PROGRAM statement. If r is not specified, a default value of 150 is used. ■"""3^ ORDERING OF STATEMENTS The following table shows the general form of a FORTRAN program unit. Statements within a group can appear in any order, but groups must be ordered as shown. Comment lines can appear anywhere within the program. STATEMENTS 1 OVERLAY 2 PROGRAM* FUNCTION* SUBROUTINE* BLOCK DATA 3 IMPLICIT 4 5 6 7 F *«% The range of a real constant is IO"293 to 10+322; if this range is exceeded, a diagnostic is printed. Precision is approximately 14 decimal digits, and the constant is stored internally in one computer word. Examples: 7.5 -3.22 +4000. 23798.14 .5 - .72 42.El 700.E-2 Examples of invalid real constants: 3,50. (comma not allowed) /**S"j\ 2. 5A (letter not allowed) Optionally, a real constant can be followed by a decimal exponent, written as the letter E and an integer con stant indicating the power of ten by which the number is to be multiplied. If the E is present, the integer constant following the letter E must not be omitted. The sign may be omitted if the exponent is positive, but it must be present if the exponent is negative. Examples: *^*^s 42.El (42. X IO1 = 420.) .00028E+5 (.00028 X IO5 = 28.) 6.205E12 (6.205 X IO12 = 6205000000000.) 8.0E+6 (8. x IO6 = 8000000.) 700.E-2 (700. X 10~2 = 7.) 7E20 (7. X IO20 = 70 000 000 000 000 000 0000.) Example of invalid real constants: ^1 7. 2E3.4 exponent not an integer DOUBLE PRECISION CONSTANT | n.nD±s .nD±s n.D±s nD±s| n C o e f fi c i e n t ) D±s Exponent (base 10) 1-6 60497800 A Double precision constants are written in the same way as real constants except the exponent is specified by the letter D instead of E. Double precision values are represented internally by two computer words, giving extra precision. A double precision constant is accurate to approximately 29 decimal digits. If the exponent is positive, the plus sign is optional. /SfPV, Examples: f* 5.834D2 (5.834 X IO2 = 583.4) 14.D-5 (14. X IO"5 = .00014) 9.2D03 (9.2 x 103 = 9200.) ^ -7.D2 (-7. X 102 = -700.) 3120D4 (3120. X IO4 = 31200000.) 0^\ Examples of invalid double precision constants: 0*^ 7.2D exponent missing D5 exponent alone not allowed 1 2,1.3D2 comma illegal i 3.141592653589793238462643383279 D and exponent missing f * C O M P L E X C O N S TA N T (M,r2) rl r2 Real part Imaginary part Complex constants are written as a pair of real constants separated by a comma and enclosed in parentheses. FORTRAN Coding Complex Number (1., 7.54) 1. + 7.54i i = yf~A~ (-2.1E1, 3.24) -21. + 3.24i (4.0, 5.0) 4.0 + 5.0i (O., -l.) 60497800 0.0 - l.Oi A 1-7 The first constant represents the real part of the complex number, and the second constant represents the imaginary part. The parentheses are part of the constant and must always appear. Either constant may be preceded by a plus or minus sign. Complex values are represented internally by two consecutive computer words. Both parts of complex constants must be real; they may not be integer. Examples of invalid complex constants: (275, 3.24) 275 is an integer 0f&$\ (12.7D-4 16.1) comma missing and double precision not allowed 4.7E+2,l.942 parentheses missing (0,0) 0 is an integer Real constants which form the complex constant can range from IO"293 to 10+322. Division of complex numbers might result in underflow or overflow (see Appendix D) even when this range is not exceeded. /*"3!"\ O C TA L n 1i C O N S TA N T .«*\ • • • nm mB n is an octal digit, 0 through 7. 1 < m < 20 octal digits An octal constant consists of 1 to 20 octal digits suffixed with the letter B. .-*..• /*m*\ Examples: 777777B 52525252B 500127345B Invalid octal constants: 892777B 8 and 9 are 77000000007777752525252B 07766 1-8 O not non-octal exceeds digits. 20 digits ■ ' ■■ ' ■ , ; . : ■ ; • ■ ; i. . . allowed 60497800 A **•»& An octal constant must not exceed 20 digits nor contain a non-octal digit. If it does, a fatal compiler diagnostic is printed. When fewer than 20 octal digits are specified, the digits are right justified and zero filled. Octal constants can be used anywhere integer constants can be used, except that they cannot be used as statement labels or statement label references, in a FORMAT statement, or as the character count when a Hollerith constant is specified. They can be used in DO statements, expressions, and DATA statements, and as dimension specifications. Examples: BAT - (I * 5252B) . OR. JAY masking expression J = jMAXO (I, iooob , J, K+40B) octal constant used as parameter in function ,|p\ NAME -.1 ..AND. 77700000B masking expression J = (5252B + N)/K arithmetic expression DIMENSION BUF(IOOOB) dimension specification When an octal constant is used in an expression, it assumes the type of the dominant operand of the expression (Table 2-1, section 2). HOLLERITH CONSTANT nHf nRf j*$pn nLf =£f-v± Unsigned decimal integer representing number of characters in string including blanks; must be greater than zero. f String of characters; must contain at least one character H String delimiter Left justified with blank fill L Left justified with binary zero fill R Right justified with binary zero fill >ip£\ /*^\ 0&>\ A Hollerith constant has two forms: one is an unsigned decimal integer followed by the letter H, L, or R and a string of characters; the other is a •?■= delimited string. Hollerith constants can be used in DATA statements, as arguments in subroutine calls or function references, and in expressions. In an expression, they are limited to 10 characters; and in a DATA statement they should be limited to 10 characters (see section 3). If a Hollerith constant is used as an operand of an arithmetic operation, an informative diagnostic is given. If a Hollerith constant is used as an argument in a subprogram call, it is followed by a zero word. 60497800 A 1-9 ,<«*r«t*X The Hollerith specification in a FORMAT statement (see section 6) is not the same as a Hollerith constant. Example:; "V./>- '":-"" ."* 'v-••-*•■.• •"-.''''' ,l' •' ;■' ;,'*.'* '"- - "" ' - -' ""-* "-/•"' "; - • •-'-- / PROGRAM HOLL (OUTPUT) I * 6HABCDEF J-=6LABCDEF K •*' 6RABCDEF L = *ABCDEF# PRINT It ItI»J»JfK»K»L»L ^' 1 - F O R M AT ***) A ^ ' <024tA15) STOP ^ ^ END /**"^"\ Stored Internally: Display Code: 01020304050655555555 ABCDEF 01020304050600000000 ABCDEF:::: 00000000010203040506 ::::ABC0EF R format' 01020304050655555555 ABCDEF nHf and H format I-format ^ ? •* format ^ •J6f*?fe ^\ These two forms produce left-justified display code constants with 10 characters per word. If the string length is not a multiple of 10, the final word is blank filled. nHf Examples: y-^-W^V 18HTHIS IS A CONSTANT 7HTHE END ^ 19HRESULT NUMBER THREE 0t Examples: "- . . F ( V. E Q . ¥ Y, E S - # 1 , ,■ " Y»Y+1. • . ' ' _ ' , ' . ,■ ';" ? '''V'-.-V'.y:..'_ •*.'..,." PRINTI^SQRT^.SQRTR) =,. F O R M AT (A10.F10.2) PRI NT 2 F O R M AT ( 2 A 1 0 ) 2, =# TEST .".„."•-•- . PA S S E D - ? * - INTEGER LINEC7), LOGICAL N E W PA G E , IF (NEWPAGE) LINE{7);= -£PAGE0-£ + N1 THRU 9 ."' " -".r '" ;; " ■• « ."'_ ■ '" ^ • ^ ' -■' • ' ' • . "* . .■'■: ■■ >• . N1THRU9 ;' . ', — ■* • /=%> ' /***^\ -**s^^. 1-10 60497800 E /cr^\ ' nRf and nLf These two forms produce display code constants with 10 characters per word. If the string length is not a multiple of 10, the final word is zero-filled, and justified; nRf indicates right justification and nLf indicates left justification. nRf Example: I VAL (IJ;- 1RA nLf Example: INDEX {■} - 3LLGO LOGICAL CONSTANT A logical constant takes the forms: .TRUE. or .T. representing the value true .FALSE, or fF. representing the value false The decimal points are part of the constant and must appear. Examples: LOGICAL XI, X2 XI = .TRUE. X2 = .FALSE. VARIABLES A variable represents a quantity whose value can be varied; this value can be changed repeatedly during program execution. Variables are identified by a symbolic name of one to seven letters or digits, beginning with a letter. A variable is associated with a storage location; whenever a variable is used, it references the value currently in that location. A variable can have its type specified in a type statement (see section 3) as integer, real, double precision, complex, or logical. In the absence of an explicit declaration, the type is implied by the first character of the name: I, J, K, L, M, and N imply type integer and any other letter implies type real, unless an IMPLICIT statement (see section 3) is used to change this normal implicit type. 60497800 A 1 - 11 «"-^\ -ExjaMpleV" 1 ' *;" , : .'--.„,. " ^: /|^lPL(C^:pOMiUiE^f^ECISION (A) \:CQWPL'EX>lprtA \, >'L . / APPLE«ORANGES+PEARS Ah, explicit declaration overrides an IMPLICIT declaration. Therefore, ALPHA is type complex; APPLE is type double precision. Default typing of variables: A-H,0-Z Real I-N Integer INTEGER VARIABLES /**^S*v An integer variable is a variable that is typed explicitly or implicitly as described under Variables. The value range is - (2S9-1) to 2S9-1. When an integer variable is used as a subscript, the maximum value is 217-1. The resulting absolute value of conversion from integer to real, or real to integer must be less than 248. The operands, as well as the result, of an integer multiplication or division must be less than 248 in absolute value. If any of these restrictions are violated, the results are unpredictable. For integer addition and subtraction, the full 60-bit word is used; the resulting absolute value must be less than 2s9. See section 4 for restrictions or integers used in DO statements. An integer variable occupies one word of memory. /-"SsX Examples: ITEM1 NSUM JSUM N72 J K2S04 REAL VARIABLES A real variable is a variable that is typed explicitly or implicitly as described under Variables. The value range is IO"293 to 10+322 with approximately 14 significant digits of precision. A real variable occupies one word of storage. Examples: AVA R SUM3 R E S U LT TO TA L 2 B E TA XXXX /f"SS"v 1-12 60497800 A DOUBLE PRECISION VARIABLES Double precision variables must be typed by a type declaration. The value of a double precision variable can range from IO"293 to 10+322 with approximately 29 significant digits of precision. Double precision variables occupy two consecutive words of memory. The first word contains the more significant part of the number and the second contains the less significant part. Example: IMPLICIT DOUBLE PRECISION(A) DOUBLE PRECISION OMEGA.X.IOTA 00$$^ The variables OMEGA, X, IOTA and all variables whose first letter is A are double precision. COMPLEX VARIABLES Complex variables must be typed by a type declaration. A complex variable occupies two words of memory; each word contains a real number. The first word represents the real part of the number and the second represents the imaginary part. Example: COMPLEX ZERA,MU.LAMBDA LOGICAL VARIABLES V Logical variables must be typed by a type declaration. A logical variable has the value true or false and occupies one word of memory. /**P\ \ r Example: LOGICAL _ L 3 3 , P R AV D A , VA L U E A R R AY S A FORTRAN array is a set of elements identified by a single name composed of one to seven letters and digits beginning with a letter. Each array element is referenced by the array name and a subscript. The type (^ of the array elements is determined by the array name in the same manner as the type of a variable is deter mined by the variable name (see Variables in this section). The array name and its dimensions must be de clared in a DIMENSION or COMMON statement or a type declaration. Arrays can have one, two, or three dimensions. The number of dimensions in the array is indicated by the number of subscripts in the declaration. dimension STOR(6) declares a one-dimensional array of six elements 60497800 A 1-13 REAL STOR{3,7) declares a two-dimensional array of three rows and seven columns LOGICAL STOR(6.6,3) declares a three-dimensional array of six rows, six columns and three planes The entire array may be referenced by the unsubscripted array name when it is used as an item in an input/ output list, as an actual parameter, or in a DATA statement. In any other context, only the first element of the array is implied by the unsubscripted, array name. Example 1: The array N consists of six values in the order: 10, 55, 11, 72, 91, 7 i*C5*^y N(l) N(2) N(3) N(4) N(5) N(6) value 10 value 55 value 11 value 72 value 91 value 7 Example 2: The two-dimensional array TABLE (4,3) has four rows and three columns. Row 1 Row 2 Row 3 Row 4 Column 1 Column 2 Column 3 44 72 10 20 11 76 105 200 30 714 91 To refer to the number in row two, column three write TABLE(2,3). TABLE(3,3) = 30 TABLE(1,1) = 44 TABLE(4,1) = 91 TABLE(4,4) would be outside the bounds of the array and results are unpredictable. Example 3: ,' . . PROGRAM VARDIM