OWG-1/29-0279 18 April 2011 Page 1 of 5 Subject: Specification of IEEE format details in inappropriate contexts Author: Charles C. Stevens Document references: 1) ISO/IEC 1989:20xx FCD 1.0 2) IEEE Std 754-2008, IEEE Standard for Floating-Point Arithmetic Previous versions of document: 3) OWG-1/29-0224, Specification of IEEE format details in inappropriate contexts 4) OWG-1/29-0242, Specification of IEEE format details in inappropriate contexts Justification: EDITORIAL In contexts outside of reference 1, 8.8.1.4. Standard-binary arithmetic; 8.8.1.5, Standarddecimal arithmetic; 13.18.59, USAGE clause general rules 13 through 17; and in some instances in Annexes D and E, existing explicit references to the binary128 and decimal128 formats as specified in Reference 2 are an inappropriate overspecification. In most instances, "binary128 form" is treated as synonymous with "standard-binary intermediate data item form" and "decimal128 form" is treated as synonymous with "standard-decimal intermediate data item form", and in context, the latter terms are more accurate and appropriate. The definitions for "SBIDI" (for standard-binary intermediate data item) and "SDIDI" (for standard-decimal intermediate data item) are editorially introduced, and the IEEE terms editorially replaced wherever it is noted that the intent was more accurately represented by the COBOL definitions. The returned value rules for three functions – PI and E – state currently that their returned value rules are in binary128 form when standard-binary arithmetic is in effect, and decimal128 form when standard-decimal arithmetic is in effect. The returned value rules for the SQRT function mention the standard intermediate data forms explicitly. These references are redundant (all numeric and integer functions return results in SBIDI or SDIDI form in these forms of arithmetic), and potentially misleading. These references are editorially deleted. In the course of this investigation, it was noted that 14.9.29, MOVE statement, General rule 5 subrule c could be understood incorrectly; it has been editorially changed to make it more precise. SET statement General rule 32 has also been editorially change to make the format used for the information match the usage specifications for the item, thus generalizing the specification. Since the FCD already specifies decimal encoding for IEEE decimal floating-point arguments, OWG-1/29-0279 18 April 2011 Page 2 of 5 there is no need to respecify that requirement here, and the language proposed is better suited to other changes being considered. Clarifications that the intermediate rounding rules apply to the conversion of operands to arithmetic, as well as during the arithmetic itself were added. Non-normative NOTEs have been added to document the maximum ranges permitted for SBIDI and SDIDI formats, and for IEEE floating-point formats. This reflects the decision by OWG-1 to endorse the inclusion of that information in non-normative text. In addition, the maximum integer values in which the trailing digit is nonzero are provided for the five supported IEEE floating-point formats. Recommended changes: 1) Page 136, 8.8.1.4.1, Standard-binary intermediate data item, introductory paragraph: Change in part to read " ... data item ("SBIDI") is of ...". [SBIDI definition] 2) Page 136, 8.8.1.4.1, Standard-binary intermediate data item, rule 1: Change in part to read " ... already in SBIDI form is converted into SBIDI form." 3) Page 136, 8.8.1.4.1, Standard-binary intermediate data item, Rule 1: Add the following sentence at the end: "If the operand value cannot be expressed exactly in an SBIDI, the value is rounded according to the rules in 11.9.7, INTERMEDIATE-ROUNDING clause." 4) Page 136, 8.8.1.4.1, Standard-binary intermediate data item: Add the following NOTE after Rule 1: NOTE Inexact representations of the values of finite non-integer decimal values may occur when such values are converted into any binary floating-point form with finite precision. 5) Page 136, 8.8.1.4.1, Standard-binary intermediate data item, rule 2: Change in part to read "... in SBIDI format ..." 6) Page 136, 8.8.1.4.1, Standard-binary intermediate data item: Add the following after all text: NOTE An SBIDI may contain the unique values +0 and -0. For purposes of numeric processing and sign tests in COBOL, both values are treated as the unique value 0. For consistency with IEEE Std 754-2008, the range of values in an SBIDI is -(2**16384 – 2**16271) to +(2**16384 – 2**16271) inclusive, with a maximum precision of 113 bits; the smallest positive nonzero value is 2**-16494; and the smallest normalized positive nonzero value is 2**-16382. 18 April 2011 OWG-1/29-0279 Page 3 of 5 7) Page 137, 8.8.4.1.3, Exponentiation in standard-binary arithmetic, rule 2e: Change in part to read " ... that value shall be in SBIDI form. All additions ..." 8) Page 138, 8.8.1.5.1, Standard-decimal intermediate data item, introductory paragraph: Change in part to read "... data item ("SDIDI") is of ...". [SDIDI definition]. 9) Page 138.8.8.1.5.1, Standard-decimal intermediate data item, second paragraph: Change in part to read " ... content of an SDIDI is ...". 10) Page 138, 8.8.1.5.1, Standard-decimal intermediate data item, rule 1: Change in part to read " ... already in SDIDI form is ...". 11) Page 138, 8.8.1.5.1, Standard-decimal intermediate data item, Rule 1: Add the following sentence at the end: " If the operand value cannot be expressed exactly in an SDIDI, the value is rounded according to the rules in 11.9.4, INTERMEDIATEROUNDING clause." 12) Page 138, 8.8.1.5.1, Standard-decimal intermediate data item: Add the following NOTE after Rule 1: NOTE Inexact representations of the values of finite non-integer binary values may occur when such values are converted into any decimal floating-point form with finite precision. . 13) Page 138, 8.8.1.5.1, Standard-decimal intermediate data item: Add the following after all text: NOTE An SDIDI may contain the unique values +0 and -0. For purposes of numeric processing and sign tests in COBOL, both values are treated as the unique value 0. For consistency with IEEE Std 754-2008, the range of values in an SDIDI is from -9.999999999999999999999999999999999e+6144 to +9.999999999999999999999999999999999e+6144 inclusive, with a maximum precision of 34 decimal digits; the smallest positive nonzero value is 1.0e-6176; and the smallest normalized positive nonzero value is 1.0e-6143. 14) Page 138, 8.8.1.5.3, Exponentiation in standard-decimal arithmetic, rule 2e: Change in part to read " ... that value shall be in SDIDI form. All additions ..." 15) Page 209, 11.9.7, INTERMEDIATE ROUNDING clause, General rules 3c, 3d, and 3e: Change each in part to read " ... represented in SBIDI form in which ...". 16) Page 209, 11.9.7, INTERMEDIATE ROUNDING clause, General rules 4b, 4c, 4d, and 4e: Change each in part to read " ... represented in SDIDI form ...". 17) Page 396, 13.18.59, USAGE clause: Add the following NOTE after General rule 13: 18 April 2011 OWG-1/29-0279 Page 4 of 5 NOTE The range of values for this usage is derived from IEEE Std 754-2008, and is from -(2**128 – 2**104) to +(2**128 – 2**104) inclusive, with a precision of 24 bits. The smallest positive nonzero value is 2**-149. The smallest normalized positive nonzero value is 2**-126. The largest positive integer value with a nonzero trailing digit is (2**25 - 1), or 33,554,431. 18) Page 396, 13.18.59, USAGE clause: Add the following NOTE after General rule 14: NOTE The range of values is derived from IEEE Std 754-2008, and is from -(2**1024 – 2**971) to +(2**1024 – 2**1971) inclusive, with a precision of 53 bits. The smallest positive nonzero value is 2**-1074. The smallest normalized positive nonzero value is 2**-1022. The largest positive integer value with a nonzero trailing digit is (2**54 - 1), or 18,014,398,509,481,983 19) Page 396, 13.18.59, USAGE clause: Add the following NOTE after General rule 15: NOTE The range of values is derived from IEEE Std 754-2008, and is from -(2**16384 - 2**16271) to +(2**16384 - 2**16271) inclusive, with a precision of 113 bits. The smallest positive nonzero value is 2**-16494. The smallest normalized positive nonzero value is 2**-16382. The largest positive integer value with a nonzero trailing digit is (2**114 - 1), or 20,769,187,434,139,310,514,121,985,316,880,383. 20) Page 396, 13.18.59, USAGE clause: Add the following NOTE after General rule 16: NOTE The range of values for this usage is derived from IEEE Std 754-2008, and is from -9.999999999999999e384 to +9.999999999999999e+384 inclusive, with a precision of 16 decimal digits. The smallest positive nonzero value is 1.0e-398. The smallest normalized positive nonzero value is 1.0e-383. The largest positive integer value with a nonzero trailing digit is (10**17 – 1), or 9,999,999,999,999,999. 21) Page 396, 13.18.59, USAGE clause: Add the following NOTE after General rule 17: NOTE The range of values for this usage is derived from IEEE Std 754-2008, and is from -9.999999999999999999999999999999999e+6144 to +9.999999999999999999999999999999999e+6144 inclusive, with a precision of 34 decimal digits. The smallest positive nonzero value is 1.0e-6176. The smallest normalized positive nonzero value is 1.0e-6143. The largest positive integer value with a nonzero trailing digit is (10**35 – 1), or 9,999,999,999,999,999,999,999,999,999,999,999. 22) Page 516, 14.9.29, MOVE statement, General rule 5 subrule c: Change in part to read " ... the same usage specification ... " 18 April 2011 OWG-1/29-0279 Page 5 of 5 23) Page 567, 14..9.35, SET statement, General rules 32a, 32b, and 32c: Change in part to read "... 3.5, Decimal interchange format encodings, as appropriate for the usage specifications of identifier-14." 24) Page 643, 15.24, E function, Returned value rule 3: Place a period after the arithmetic expression, and delete all text from "in Binary128 format" to the end of the rule inclusive. 25) Page 643, 15.24, E function, Returned value rule 4: Place a period after the arithmetic expression, and delete all text from "in Decimal128 format" to the end of the rule. 26) Page 689, 15.68, PI function, Returned value rule 3: Place a period after the arithmetic expression, and delete all text from "in Binary128 format" to the end of the rule. 27) Page 689, 15.68, PI function, Returned value rule 4: Place a period after the numeric literal, and delete all text from "in Decimal128 format" to the end of the rule. 28) Page 699, 15.78, SQRT function, Returned value rule 3: Delete "and stored in a standard-decimal intermediate data item." 29) Page 699, 15.78, SQRT function, Returned value rule 4: Delete "and stored n a standard-binary intermediate data item." 30) Page 808, D.17, Forms of arithmetic, ninth paragraph: Change in part to read " ...from SDIDI form to a binary form before ..." 31) Page 808, D.17, Forms of arithmetic, tenth paragraph: Change to read in part "... from SBIDI form to a decimal form before ...". 32) Page 870, E.3, Substantive changes not affecting existing programs, Item 9: Change text to read "The ability to perform basic arithmetic with operands, intermediate results, and exception conditions consistent with the requirements of IEEE Std 754-2008 for binary128 and decimal128 formats as described therein has been added."