24.11.2014 Views

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Format<br />

11.7.10.2 Floating-point Editing: F, E, D and G Edit Descriptors<br />

The F, E, D and G edit descriptors describe the editing of real, double precision, complex and double<br />

precision complex data. The I/O list item corresponding to one of these edit descriptors must be of type<br />

real, double precision, complex or double precision complex. On input, the I/O list item will become<br />

defined with a datum whose type is the same as that of the I/O list item. On output, the I/O list item must<br />

be defined with a datum whose type is that of the I/O list item.<br />

11.7.10.3 F Editing<br />

An F edit descriptor has the form Fw.d where w is the field width and d is the number of digits in the<br />

fractional part. The input field consists of an optional sign, followed by a string of digits optionally<br />

containing a decimal point. If the decimal point is omitted, the rightmost d digits with leading zeroes<br />

assumed if necessary, are interpreted as the fractional part of the value represented. An exponent of one of<br />

the following forms may follow.<br />

1. A signed integer constant.<br />

2. An E or D followed by an optionally signed integer constant.<br />

Consider the following example, where the decimal point is omitted. The formula used in the evaluation is:<br />

-d (exponent subfield)<br />

(integer subfield) x 10 x 10<br />

If the specification is F10.8 and the input quantity is 31415E+5 then the following conversion takes place.<br />

-8 5<br />

00031415 x 10 x 10<br />

= .00031415 x 10<br />

5<br />

= 31.415<br />

In other words, the decimal point is assumed to lie to the left of the 8 digits (padded with zeroes on the left)<br />

forming the fractional part of the input value.<br />

The output field produced by an F edit descriptor consists of blanks if necessary followed by a minus sign<br />

if the item in the I/O list is negative or an optional plus sign otherwise, followed by a string of digits<br />

containing a decimal point which represents the magnitude of the I/O list item. The string representing the<br />

magnitude of the I/O list item is modified according to the scale factor and is rounded to d fractional digits.<br />

An optional leading zero is produced only if the magnitude of the I/O list item is less than one. Note that a<br />

leading zero is required if there would otherwise be no digits in the output field.<br />

Example:<br />

PRINT ’(1H)’, 234.43<br />

The output produced by the PRINT statement in the previous example is the string:<br />

<br />

Editing 233

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!