[Cfp-interest 1964] Default static initialization

Fred J. Tydeman tydeman at tybor.com
Sun Apr 11 05:58:55 PDT 2021


On Thu, 25 Mar 2021 08:45:23 -0600 Rajan Bhakta wrote:
>
>      Fred: Check with the CFP group (and possibly others) to see if the
>default static initialization gives all zero bits for DFP values.

Attached.

Should we also add a footnote to 6.7.9 along the lines of:

All bits zero in a decimal floating point object is a zero with least possible quantum exponent (as required by 5.2.4.2.3).


---
Fred J. Tydeman        Tydeman Consulting
tydeman at tybor.com      Testing, numerics, programming
+1 (702) 608-6093      Vice-chair of PL22.11 (ANSI "C")
Sample C99+FPCE tests: http://www.tybor.com
Savers sleep well, investors eat well, spenders work forever.

-------------- next part --------------

   Submitter:CFP group
   Submission Date: 2021-??-??
   Document: WG14 N26??
   Title: N26??: static initialization of DFP zeros
   Reference Documents:WG14 N2596, SC22WG14.19047, CFP 1945

   Summary: While the C standard says that the default initialized value
   for static objects is zero, there is no mention of which quantum
   exponent a decimal floating point value should be given.

   These page numbers are for N2596.

   Page 112, 6.7.9 Initialization, paragraph 10, has (in part):

     If an object that has static or thread storage duration is not
     initialized explicitly, then: ... if it has arithmetic type, it is
     initialized to (positive or unsigned) zero;

   There is no mention of quantum exponent there. We suggest adding to
   the table of preferred quantum exponents on page 30 in paragraph 10 of
   5.2.4.2.3 Characteristics of decimal floating types in <float.h>

     [INS: default static initialization --- least possible :INS]


More information about the Cfp-interest mailing list