Document: WG14 N1377
Submitter: Fred Tydeman (USA)
Submission Date: 2009-03-31
Previous version of paper: N1303, N1317, N1352
Related WG14 documents: N1151, N1171
Subject: xxx_DECIMAL_DIG macros for <float.h>
Existing practice: C99 has DECIMAL_DIG with the similar meaning as LDBL_DECIMAL_DIG.
This is a rewrite based upon feedback from the committee.
Changes to C1x
Add new bullets to 126.96.36.199.2 Characteristics of floating types <float.h>
[bullet near DECIMAL_DIG] number of decimal digits, n, such that any floating-point number with p radix b digits can be rounded to a floating-point number with n decimal digits and back again without change to the value,
p log10 b if b is power of 10 ceil(1 + p log10 b) otherwise
[Note to editor: WG14 C1x WP for DECIMAL_DIG has correct symbols/fonts for the above two math expressions.]
FLT_DECIMAL_DIG 6 DBL_DECIMAL_DIG 10 LDBL_DECIMAL_DIG 10
[paragraph 14, example 1] Add
FLT_DECIMAL_DIG 9after FLT_RADIX
[paragraph 15, example 2] Add
FLT_DECIMAL_DIG 9 DBL_DECIMAL_DIG 17before DECIMAL_DIG
Words for Rationale:
[add to 188.8.131.52.2 section] For applications that need to print non-decimal FP values as decimal values, and read them later, can use xxx_DECIMAL_DIG macros as the precision to make sure that the original value is kept.