Simplify HUGE_VAL definitions [committed]

Zack Weinberg zackw@panix.com
Fri Sep 1 11:42:00 GMT 2017


On 08/31/2017 12:53 PM, Joseph Myers wrote:
> On Thu, 31 Aug 2017, Zack Weinberg wrote:
>>
>>    Otherwise use a numeric constant larger than the largest
>>    representable finite value in any supported floating-point
>>    format; in the normal rounding mode, ISO C requires this to be
>>    rounded to +Infinity, if it exists, or else to the largest
>>    representable positive value.

Hang on, is this actually true?  N1570 §6.4.4.2p3 says

# ... For decimal floating constants, and also for hexadecimal
# floating constants when FLT_RADIX is not a power of 2, the result is
# either the nearest representable value, or the larger or smaller
# representable value immediately adjacent to the nearest
# representable value, chosen in an implementation-defined manner.

which would appear to license 1e10000 to be converted to either +Inf
or DBL_MAX regardless of rounding mode.

(Same wording in C99.)

zw



More information about the Libc-alpha mailing list