FORTRAN-80

Input/Output

Scale Factor (P) Editing

A scale factor is established by the' kP' edit descriptor, where' k' represents the scale factor. It is used with the 'F' and 'E' descriptors to edit real numbers. No comma is needed between the 'P' descriptor and an immediately following 'F' or 'E.'

1PE8.6E2

A scale factor of zero is assumed at the beginning of an 110 statement. Once it has been changed by the' kP' edit descriptor, the new scale factor remains in effect until the' kP' descriptor is issued again or until the end of the 110 statement.

On input, the scale factor has no effect if there is an exponent in the 'F' or 'E' edited field. Otherwise, the effect of the scale factor is that the externally-represented number equals the internally represented number multiplied by '10**k.' The same is true of output with 'F' editing. On output with 'E' editing, the basic real constant part of the quantity to be produced is multiplied by '10**k' and the exponent is reduced by 'k.'

As we saw in the description of 'E' descriptor editing, the output range of a multiplier printed in scientific notation with a scale factor of zero is 0.1 to 1.0. Changing the scale factor to one changes the multiplier range to 1.0 - 10.0. Changing the scale factor is useful for very large or very small 'E' edited numbers, but is generally not desirable for 'F' edited numbers. Following specification of a nonzero scale factor, the scale factor should probably be respecified as 'OP' before the next occurrence of 'F' editing.

The following table of number representations illustrates instances where 'E' editing and the use of the scale factor would be most applicable. The column headings show the field descriptor used to produce each representation.

Real Number

FS.2

E10.5

 

1 PE10.4

4.32

4.32

0.43200E

+ 01

4.3200E+00

7255000.0

******

O. 72550E

+ 07

7.2550E+06

0.0065

0.01

0.65000E-02

6.5000E-03

Clearly, 'F' descriptor editing is preferable for simple numbers like '4.32.' Just as clearly, 'F' descriptor editing is inadequate for very large or very small numbers like '7255000' or '0.0065.'

'BN' and 'BZ' Editing

These two edit descriptors are used for input only and affect only numeric editing. They can be used to specify the interpretation of blanks, other than leading blanks. If 'BN' is specified, blanks are ignored except that a field of all blanks is treated as zero. If 'BZ' is specified, blanks are regarded as zeros.

Until the 'BZ' or 'BN' descriptor is specified (or, if neither is specified), the BLANK specifier in the OPEN statement (section 6.2.1.9) determines the interpretation of blanks.

Example:

READ (2,50) INTNUM, FPNUM

50 FORMAT (BN, 15, 5X, F7.4)

DollytSigfjl$ijitrrrg·

Th¢..•~oll.~f•••.$~~·~•••••• ~.~.).···.·e~l~.••.••(J~~pti~t?f..·•••~.s·....·.~.~~~.·.p~i~~t~l,~•••.f~r~~~~r~~ti,~~.•ilq...t~r?Mgp.·L.a

c()nsoletYFl1l~l\l~LJtlea~~s.~·~l\tYF~inalfnlrs~r~tr~~~~§~~~~n~m,tn~~i~tel~fCl)~19\Ving

the I/Odataju~t pr()ces$ed;·rathe:rthant>egil1nill,gan1tw~ine~Ifthe·f{)r.i)lat·c()l1tTlpl

6-21

Page 81
Image 81
Intel fortran-80 manual Read 2,50 INTNUM, Fpnum, DollytSigfjl$ijitrrrg·