The floating-point (or E) format item describes the character representation of a real floating-point decimal arithmetic data value.
|
The following must be true:
w >= s = d+1 or w = 0
When w ¬= 0
s > 0, d >= 0
The values for w, d, and s are field-width, fractional-digits, and significant-digits, respectively.
On input, either the data value in the data stream is an optionally signed real decimal floating-point or fixed-point constant located anywhere within the specified field or the CONVERSION condition is raised. (For convenience, the E preceding a signed exponent can be omitted.)
The field width includes leading and trailing blanks, the exponent position, the positions for the optional plus or minus signs, the position for the optional letter E, and the position for the optional decimal point in the mantissa.
The data value can appear anywhere within the specified field; blanks can appear before and after the data value in the field and are ignored. If the entire field is blank, the CONVERSION condition is raised. When no decimal point appears, fractional-digits specifies the number of character positions in the mantissa to the right of the assumed decimal point. If a decimal point does appear in the number, it overrides the specification of fractional-digits.
If field-width is 0, there is no assignment to the data-list item.
The statement:
get file(A) edit (Cost) (E(10,6));
obtains the next 10 characters from A and interprets them as a floating-point decimal number. A decimal point is assumed before the rightmost 6 digits of the mantissa. The value of the number is converted to the attributes of COST and assigned to this variable.
On output, the data-list item is converted to floating-point and rounded if necessary. The rounding of data is as follows: if truncation causes a digit to be lost from the right, and this digit is greater than or equal to 5, 1 is added to the digit to the left of the truncated digit. This addition might cause adjustment of the exponent.
The character string written in the stream for output has one of the following syntaxes:
|
w must be >=s+6 for positive values, or >=s+7 for negative values.
When the value is nonzero, the exponent is adjusted so that the leading digit of the mantissa is nonzero. When the value is zero, zero suppression is applied to all digit positions (except the rightmost) of the mantissa.
|
w must be >=s+7 for positive values, or >=s+8 for negative values.
When the value is nonzero, the exponent is adjusted so that the leading digit of the mantissa is nonzero. When the value is zero, zero suppression is applied to all digit positions (except the first) to the left of the decimal point. All other digit positions contain zero.
|
w must be >=d+8 for positive values, or >=d+9 for negative values.
When the value is nonzero, the exponent is adjusted so that the first fractional digit is nonzero. When the value is zero, each digit position contains zero.
The exponent is a 4-digit integer, which can be 4 zeros.
If the field width is such that significant digits or the sign are lost, the SIZE condition is raised. If the character string does not fill the specified field on output, the character string is right-adjusted and extended on the left with blanks.