[Cfp-interest 2202] Re: contradiction about the INFINITY macro

Jim Thomas jaswthomas at sbcglobal.net
Tue Oct 5 11:13:59 PDT 2021


I suggest changing 

	else to a positive constant of type float that overflows at translation time

to

	else to an expression of type float that overflows with positive sign at translation time

This is intended to allow the implementation to use whatever magic is needed.

I had lost track of this issue and neglected to put it on the September CFP agenda. If we can converge on a resolution, and if no one objects, I can submit a paper with our agreed suggested change before the deadline. Please send any comments ASAP.

- Jim Thomas

> On Sep 29, 2021, at 6:54 PM, Vincent Lefevre <vincent at vinc17.net> wrote:
> 
> 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)
> _______________________________________________
> Cfp-interest mailing list
> Cfp-interest at oakapple.net
> http://mailman.oakapple.net/mailman/listinfo/cfp-interest




More information about the Cfp-interest mailing list