Document: WG14 N1378


xxx_TRUE_MIN macros for <float.h>


Submitter: Fred Tydeman (USA)
Submission Date: 2009-03-31
Previous version of paper: N1303, N1317, N1352
Related WG14 documents: N1151, N1171
Related WG21 documents: N2798
Subject: xxx_TRUE_MIN macros for <float.h>

Existing practice: Many implementation have macros (with various spellings) for the minimum positive subnormal numbers. C++ has similar symbols.

This is a rewrite based upon feedback from the committee.

Changes to C1x

Add new bullets to 5.2.4.2.2 Characteristics of floating types <float.h>

[bullet after FLT_MIN] minimum positive floating-point number. If subnormal numbers are present, their value is the minimum positive subnormal (also known as denormal) floating-point number, otherwise the minimum positive normal floating-point number, of the respective types.

FLT_TRUE_MIN        1E-37
DBL_TRUE_MIN        1E-37
LDBL_TRUE_MIN       1E-37

[bullet after FLT_MIN] The presence or absence of subnormal numbers are characterized by the values:

-1  Indeterminate (cannot be determined if type allows subnormal values)
0  Absent (type does not allow subnormal values)
+1  Present (type does allow subnormal values and operations on
those values follow IEC 60559)

for each respective type via:

FLT_HAS_SUBNORM
DBL_HAS_SUBNORM
LDBL_HAS_SUBNORM

[paragraph 15, example 2] Remove "normalized" from just before IEC 60559.

Add

FLT_TRUE_MIN        1.40129846E-45 // decimal constant
FLT_TRUE_MIN        0X1P-149F // hex constant
FLT_HAS_SUBNORM      +1
DBL_TRUE_MIN        4.9406564584124654E-324 // decimal constant
DBL_TRUE_MIN        0X1P-1074 // hex constant
DBL_HAS_SUBNORM      +1
after FLT_MIN and DBL_MIN.

Words for Rationale:

[add to 5.2.4.2.2 section] For applications that need to check, at translation time, if subnormal floating-point numbers are supported, can check for xxx_HAS_SUBNORM having the value +1, where xxx is FLT, DBL, or LDBL.

The values of the smallest subnormal floating-point numbers (if supported) are typically, but not always, FLT_MIN*FLT_EPSILON, DBL_MIN*DBL_EPSILON, LDBL_MIN*LDBL_EPSILON.