To: J3 J3/12-102 From: Tobias Burnus Subject: G editing to a narrow output field Date: 2012 January 11 References: WG5/N1830 ---------------------------------------------------------------------- NUMBER: TBD TITLE: G editing to a narrow output field KEYWORDS: G edit descriptor, narrow field, asterisks DEFECT TYPE: TBD STATUS: TDB QUESTION: What will be the output for the following program: PROGRAM MAIN PRINT '(G6.5)', 1.0 END Will it print six asterisks ("*****") or 2 followed by four blanks ("** ")? WG5/N1830 has (R1007) G w [ . d [ E e ] ] and [p251, 10.7.2.1] "Numeric editing"/"General rules" (4) On output, the representation is right justified in the field. If the number of characters produced by the editing is smaller than the field width, leading blanks are inserted in the field. (5) On output, if an exponent exceeds its specified or implied width using the E, EN, ES, D, or G edit descriptor, or the number of characters produced exceeds the field width, the processor shall fill the entire field of width w with asterisks. However, the processor shall not produce asterisks if the field width is not exceeded when optional characters are omitted. and [p. 558, 10.7.5.2.2, paragraph 1] "Generalized real and complex editing" The form and interpretation of the input field is the same as for Fw.d editing (10.7.2.3.2). [p. 558, 10.7.5.2.2, paragraph 4] Otherwise, the method of representation in the output field depends on the magnitude of the internal value being edited. Let N be the magnitude of the internal value and r be the rounding mode value defined in the table below. If 0 < N < 0.1 - r**(d-1) or N >= 10**d - r, or N is identically 0 and d is 0, Gw.d output editing is the same as k PEw.d output editing and Gw.d Ee output editing is the same as k PEw.d Ee output editing, where k is the scale factor (10.8.5). If 0.1 - r * 10**(-d-1) <= N < 10**d - r or N is identically 0 and d is not zero, the scale factor has no effect, and the value of N determines the editing as follows: ---------------------------------------------------------------------- Magnitude of Internal Value Equivalent Conversion ---------------------------------------------------------------------- N = 0 F(w-n).(d-1), n('b') 0.1 - r * 10**(-d-1) <= N < 1 - r * 10**(-d) F(w-n).d, n('b') 1 - r * 10**(-d) <= N < 10 - r * 10**(-d+1) F(w-n).(d-1), n('b') 10 - r * 10**(-d+1) <= N < 100 - r * 10**(-d+2) F(w-n).(d-2), n('b') ... ... 10**(d-2) - r * 10**(-2) <= N < 10**(d-2) - r * 10**(-1) F(w-n).1, n('b') 10**(d-1) - r * 10**(-1) <= N < 10**(d) - r F(w-n).0, n('b') ---------------------------------------------------------------------- where b is a blank, n is 4 for Gw.d and e + 2 for Gw.d Ee, and r is defined for each rounding mode as follows: [...] ANSWER: EDITS: SUBMITTED BY: Tobias Burnus