如果 C 标准允许 "double == float",那么为什么它需要 DBL_DECIMAL_DIG 和 DBL_DIG >= 10(而不是 >=6)?

If C standard allows "double == float", then why it requires DBL_DECIMAL_DIG and DBL_DIG >= 10 (and not >=6)?

N2596 工作草案 — 2020 年 12 月 11 日 ISO/IEC 9899:202x (E):

The values given in the following list shall be replaced by implementation-defined constant expressions with values that are greater than or equal to those shown:

#define DBL_MAX                1E+37
#define FLT_MAX                1E+37

The values given in the following list shall be replaced by implementation-defined constant expressions with (positive) values that are less than or equal to those shown:

#define DBL_MIN                1E-37
#define FLT_MIN                1E-37

The values given in the following list shall be replaced by implementation-defined constant expressions that are greater or equal in magnitude (absolute value) to those shown, with the same sign:

#define DBL_DECIMAL_DIG        10
#define DBL_DIG                10
#define FLT_DECIMAL_DIG        6
#define FLT_DIG                6

问题:如果标准允许 DBL_MAX == 1E+37DBL_MIN == 1E-37(即 double 的属性 == float 的属性),那么为什么它需要 DBL_DECIMAL_DIG >= 10DBL_DIG >= 10(而不是 DBL_DECIMAL_DIG >= 6DBL_DIG >= 6)?

P.S。也许我错过了什么。请指正方向

If C standard allows "double == float", then why it requires DBL_DECIMAL_DIG and DBL_DIG >= 10 (and not >=6)?

double可能等同floatDBL_DECIMAL_DIG≥10且FLT_DECIMAL_DIG≥6的条件一致因为他们对用于 doublefloat 的格式感到满意,因此 DBL_DECIMAL_DIG = 10 和 FLT_DECIMAL_DIG = 10.

FLT_DECIMAL_DIG ≥ 6 的条件不是多余的,因为条件被用于 double 的一种格式满足 DBL_DECIMAL_DIG = 10 而另一种格式用于 float 这样 FLT_DECIMAL_DIG = 6.

DBL_DIGFLT_DIG 上面没有讨论但是是类似的。)

Question: if the standard allows DBL_MAX == 1E+37 and DBL_MIN == 1E-37 (i.e. properties of double == properties of float), then why it requires DBL_DECIMAL_DIG >= 10 and DBL_DIG >= 10 (and not DBL_DECIMAL_DIG >= 6 and DBL_DIG >= 6)?

DBL_MAXDBL_MIN 表示指数范围。 DBL_DECIMAL_DIGDBL_DIG 代表精度。这些没有直接关系;可以独立于精度选择指数范围,反之亦然。