Last modified on Wednesday, January 31, 1996 - 5:45:19 PM
In many of the example, I include a line such as the following.
123456789012345678901234567890123456789012345
This line is not part of the example input or output. It is there merely to show your position on a line.
b.
If the format is 20F5.1, the second line of this pair:
12345678901234567890123456789012345 bb354bb27b27.1b.365367.20-89142.1E6
would be interpreted by the program as 35.4, 27.0, 27.1, 0.3653, 67.2, -891.4, 2100000
The first number the program reads is
bb354Because this is F5.1 format, the program assumes that a decimal point goes before the last digit making the number 35.4.
The second number the program reads is
bb27bThe program treats the final
bas a 0 and places a decimal point before that final 0. The number is thus 27.0.
The third number the program reads is
27.1bOnce again program treats the final
bas a 0. In this case, however, the decimal point was already specified so the final number that the program uses is 27.1 not 271.0.
The fourth number the program reads is
.3653which is interpreted as 0.3653. Note that ordinarily there would only be one digit after the decimal point with F5.1 format but because the decimal point was specified in the input file, we have 4 digits after the decimal for this number. However, if this number were printed in F5.1 format, it would be rounded to 0.4.
The fifth number the program reads is
67.20which is interpreted as 67.2. Note that there was no blank space between the fourth and fifth numbers in the input file.
The sixth number the program reads is
-8914which is interpreted as -891.4. Note that you have to include the minus sign for negative numbers.
The seventh number the program reads is
2.1E6which means "2.1 times 10 raised to the 6'th power" or in other words 2,100,000.
Go back to Fortran Formats
Go back to Contents
The "E" can be omitted. Thus a number could be entered as 5.43-3 and would be interpreted as .00543. If 543-3 was read in E5.2 format , it would be interpreted as .00543 because the decimal place would be inserted two spaces to the left of the beginning of the exponent ("-3"). Thus E format differs from F format in that a decimal point is inserted in numbers which are in scientific notation and in that the E in scientific notation may be omitted.
b.
If the format is 20E5.1, the second line of this pair:
123456789012345678901234567890123456789012345 bb354bb27b27.1b.365367.20-89142.1E6234-3.54-2
would be interpreted as 35.4, 27.0, 27.10, .3653, 67.20, -89.14, 2100000, 0.0234, 0.0054
The first seven numbers are interpreted in the same way as the F format. The eighth number the program reads is
234-3which is interpreted as 0.0234. First, the decimal place is inserted one place to the left of the
234to make it
23.4. An E is assumed to occur between the
234and the
-3to make the number
23.4E-3which means 0.0234
The ninth number the program reads is
.54-2which is interpreted as 0.0054. The decimal point in the
.54takes precedence over insertion of a decimal point. An E is assumed to occur between the
.54and the
-2so the number is interpreted as
.54E-2or 0.0054.
Go back to Fortran Formats
Go back to Contents
6.73656 879463.5 0.00000034536 23.1 567.3 .0000045
The numbers would be printed as
123456789012345678901234567890123456789012345 bb6.74bbbbbb8.79E+05
bb3.45E-07bb23.1
bb567.bbbbb4.500E-06
Note that the entire last number could have been printed in a field width of 10 but because the last 4 spaces were reserved for the exponents, it was too long and had to be printed in E format.
Go back to Fortran Formats
Go back to Contents
b1b2bb22b33b-2
In this example blank spaces are represented by
bGo back to Fortran Formats
123456789012345678901234567890123456789012345 THIS IS A TEST
would be stored in computer memory as
THIS bISb AbTE STbb
If these were printed in 20A4 format, the result would be
THIS IS A TEST
Go back to Fortran Formats
Go back to Contents