To input numbers in scientific notation on the Apple FORTRAN system with both the E and F format specifications, follow this example:
10 FORMAT ( E10.2 )
READ (A, 10)
When you specify an input field as E10.2, FORTRAN sets aside a field of 10 places, and will put the decimal two places in from the right unless the input string has an explicit decimal point in it.
Another intresting result occurs if you enter the number in scientific notation. FORTRAN reads in the number up to the E and then starts reading the exponent using the next format specification in the FORMAT statement. The example above would use the E10.2 spec for both the mantissa and the exponent.
The string 1.0E1 would be read as 1 times ten raised to ten to the tenth power.
10
10
1 * 10 = 1 followed by 10000000000 zeros.
This, of course, causes an overflow error.
You can get around this problem either by specifying a decimal in the exponent or by padding the input field with spaces. The following example has the entered string in brackets to indicate the extra spaces.
You enter Fortran interprets
>1.0E1< 10000000.00
>1 E1 < 1.00
>1.0E1.0< 1.00
>1.0E1 < 1.00 |