J3/12-115r1 To: J3 From: Malcolm Cohen Subject: Editorial changes for intrinsic procedures. Date: 2012 February 13 1. Introduction There are a number of minor wording problems with several of the intrinsic procedures, mostly in the Resolve Value paragraphs. This paper describes some of these problems and proposes fixes. 2. Problems with INDEX The problems noted in 12-115 will be dealt with by a separate paper. 3. CMPLX problem The Result Value paragraph for CMPLX does not specify the value of CMPLX(X,Y) - it requires the KIND argument to be present. [337:26] 13.7.36 CMPLX, Result Value paragraph, second sentence, Delete ", KIND". {This is completely unnecessary and only works if KIND is present.} [337:28] Append new sentence to paragraph "The result of CMPLX(X,Y) is equal to CMPLX(X,Y,KIND(0.0)).". {Specify what the result of CMPLX(X,Y) is.} 4. COUNT problem The Result Value paragraph for COUNT does not specify the value of COUNT(..., KIND), Case (i) only specifies the result of COUNT(MASK) and Case (ii) only specifies the result of COUNT(MASK,DIM). [339:4] 13.7.41 COUNT, Result Value paragraph, Change "The result of COUNT(MASK)" to "If DIM is absent or MASK has rank one, the result". {Specify both COUNT(MASK) and COUNT(MASK,KIND=...), and catch the redundant DIM case as well.} [339:6] Delete "If MASK ... COUNT (MASK).". {Now handled by Case (i).} [339:7-8] Change "Otherwise" to "If DIM is present and MASK has rank n>1", Change "of COUNT(MASK,DIM)" to "of the result", Change "COUNT (MASK ($s_1$, ..., $s_n$))" to "the number of true elements of MASK ($s_1$, ..., $s_n$)". NOTE: Thus making that sentence read "If DIM is present and MASK has rank $n > 1$, element ( $s_1$, $s_2$, ..., $s_{\text{DIM}-1}, $s_{\text{DIM}+1}$, ..., $s_n$) of the result has a value equal to the number of true elements of MASK( $s_1$, $s_2$, ..., $s_{\text{DIM}-1}, :, $s_{\text{DIM}+1}$, ..., $s_n$)." {Correctly specify COUNT(MASK,DIM) and COUNT(MASK,DIM,KIND). Note that the corrected version is not significantly longer than the incorrect version!} 5. FINDLOC problem The problem noted in 12-115 will be dealt with by a separate paper. 6. IACHAR problem The Result Value sentence suddenly changes halfway from talking about the result in all cases to the result only in the KIND-absent case. [352:16-17] Change "and satisfies the inequalities ... 127)" to "; it is non-negative and less than or equal to 127". 7. ICHAR problem This is similar to IACHAR. There is an additional problem in that ICHAR(ucs4char,1) is highly likely not to work (it is a great pity that we added the unnecessary KIND argument to this intrinsic!). [355:11] 13.7.77, Result Value paragraph, Change "and is in the range ... $n - 1$" to "; it is non-negative and less than $n$". [355:12] Before "For any", insert new sentence. "The kind type parameter of the result shall specify an integer kind that is capable of representing $n$." 8. INT problem The problem noted in 12-115 will be dealt with by a separate paper. 9. LBOUND problem a. The result value is unspecified when KIND is present. b. Case (i) says that for an array section, "the result value is 1", without limiting itself to the case when DIM is present. [360:11] 13.7.90 LBOUND, Result Value paragraph, Before "ARRAY is a whole array" insert "DIM is present," and after "whole array" insert a comma, Change "LBOUND (ARRAY, DIM)" to "the result" {Handle KIND automatically.} [360:12] After "Otherwise" insert ", if DIM is present,". {Fix contradiction.} [360:14] Append sentence "LBOUND(ARRAY,KIND=KIND) has a value whose $i^{th}$ element is equal to LBOUND (ARRAY, $i$, KIND), for $i =$ 1, 2, ..., $n$, where $n$ is the rank of ARRAY." {Simply repeat the LBOUND(ARRAY) definition with the addition of KIND.} 10. LCOBOUND problem This is similar to LBOUND, but because we don't have cosections it is easy to repair this. Also the wording for Case (i) uses the term "cosubscript" where "codimension" is intended. [360:31] 13.7.91 LCOBOUND, Result Value paragraph, Change "LCOBOUND (COARRAY, DIM)" to "If DIM is present, the result". And change "cosubscript" to "codimension". [360:33] Replace "LCOBOUND (COARRAY)" with "If DIM is absent, the result", [360:34] Replace "LCOBOUND (COARRAY, $i$)" with "the lower cobound for codimension $i$ of COARRAY". 11. MAXLOC problem The Result Value paragraph for MAXLOC does not specify the value when KIND is present. Nor when BACK is present - read cases (i) to (iii) carefully, they ALL exclude BACK! Arguably case (iii) contradicts cases (i) and (ii) with its unconditional "Otherwise". Still, it's easier to fix than FINDLOC. [367:1] "The result of MAXLOC (ARRAY)" ->"If DIM does not appear and MASK is absent, the result" {Include KIND and BACK.} [367:5] "The result of MAXLOC (ARRAY, MASK = MASK)" ->"If DIM does not appear and MASK is present, the result". {Include KIND and BACK.} [367:10-11] ", MAXLOC (ARRAY, DIM = DIM [, MASK = MASK]) is a scalar whose value is" ->"and DIM is specified, the result has a value equal to" {Include KIND and BACK.} [367:11,14] Before "]" insert ", KIND = KIND, BACK = BACK". {Include KIND and BACK, twice.} [367:11] After "Otherwise," insert "if DIM is specified,". {Conditionalise the rest on DIM being present.} 12. MINLOC Same as MAXLOC, mutatis mutandis. 13. UBOUND Same as LBOUND, mutatis mutandis. 14. UCOBOUND Same as LCOBOUND, mutatis mutandis. ===END===