The P edit descriptor scales real input values by a power of 10. It also gives you more control over the significant digit displayed for output values.
The general form is:
Parameter |
Description |
k |
Integer constant, with an optional sign |
k is called the scale factor, and the default value is zero.
Example: I/O statements with scale factors:
READ ( 1, '( 3P E8.2 )' ) X WRITE ( 1, '( 1P E8.2 )' ) X
P by itself is equivalent to 0P. It resets the scale factor to the default value 0P. This P by itself is nonstandard.
The scale factor is reset to zero at the start of execution of each I/O statement. The scale factor can have an effect on D, E, F, and G edit descriptors.
On input, any external datum that does not have an exponent field is divided by 10k before it is stored internally.
Input examples: Showing data, scale factors, and resulting value stored:
Data |
18.63 |
18.63 |
18.63E2 |
18.63 |
Format |
E8.2 |
3P E8.2 |
3P E8.2 |
-3P E8.2 |
Memory |
18.63 |
.01863 |
18.63E2 |
18630. |
On output, with D, and E descriptors, and with G descriptors if the E editing is required, the internal item gets its basic real constant part multiplied by 10^{k}, and the exponent is reduced by k before it is written out.
On output with the F descriptor and with G descriptors, if the F editing is sufficient, the internal item gets its basic real constant part multiplied by 10^{k} before it is written out.
Output Examples: Showing value stored, scale factors, and resulting output:
Memory |
290.0 |
290.0 |
290.0 |
290.0 |
Format |
2P E9.3 |
1P E9.3 |
-1P E9.3 |
F9.3 |
Display |
29.00E+01 |
2.900E+02 |
0.029E+04 |
0.290E+03 |