[Cfp-interest 2169] contradiction about the INFINITY macro

Vincent Lefevre vincent at vinc17.net
Wed Sep 29 18:54:06 PDT 2021


I have posted the following to comp.std.c (note: this is a case where
float is not an IEEE 754 type, as there are no values representing an
infinity):

In ISO C99:TC3 to C17, 7.12p4:

  The macro INFINITY expands to a constant expression of type float
  representing positive or unsigned infinity, if available; else to a
  positive constant of type float that overflows at translation time.

Consider the "else" case. It is said that INFINITY expands to a
constant and that it overflows, so that it is not in the range of
representable values of float.

But in 6.4.4p2:

  Each constant shall have a type and the value of a constant shall
  be in the range of representable values for its type.

which would imply that INFINITY expands to a value in the range of
representable values of float, contradicted by 7.12p4.

Same issue in the current C2x draft N2596 (7.12p7 and 6.4.4p2).

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the Cfp-interest mailing list