Authors: Jay Ghiron
Date: 2026-06-23
Submitted against: C23
Status: Open
There is a notion of an unsigned infinity:
In addition, floating types may be able to contain other kinds of floating-point numbers, such as subnormal floating-point numbers and unnormalized floating-point numbers, and values that are not floating-point numbers, such as NaNs and (signed and unsigned) infinities.
(C23 5.3.5.3.3 "Characteristics of floating types" paragraph 8.)
However, the meaning of an unsigned infinity does not seem to have been considered throughout the standard. Second, it appears that negative infinity and positive infinity can be supported independently:
In addition, if negative infinity is representable in a type, the range of that type is extended to all negative real numbers; likewise, if positive infinity is representable in a type, the range of that type is extended to all positive real numbers.
(C23 5.3.5.3.3 "Characteristics of floating types" paragraph 19.)
If both had to be supported at the same time, then it would not make sense to mention each individually here.
If positive infinity is supported in float but negative infinity is
not supported in float, what does trying to negate positive infinity
or using copysign to attempt to create negative infinity yield?
This also applies to strtod("-inf",0) if double supports positive
infinity but not negative infinity.
If negative infinity is supported in float but positive infinity is
not supported in float, what does trying to negate negative infinity
or using copysign to attempt to create positive infinity yield?
Additionally, what would the result of strtod("inf",0) be if
double supports negative infinity but not positive infinity? Though
the wording does just say:
A character sequence
INForINFINITYis interpreted as an infinity, if representable in the return type, else like a floating constant that is too large for the range of the return type.
(C23 7.24.2.6 "The strtod, strtof, and strtold functions" paragraph 5.)
Which does not specify the sign of the infinity, even if both signs
are supported. If it results in negative infinity, then
strtod("-inf",0) instead will attempt to form positive infinity.
Can signed infinities and an unsigned infinity be representable at the
same time? If so, that would lead to lots of questions about whether
signed or unsigned infinities should be used in contexts such as
INFINITY. For all following questions, assume that the only
infinity supported in both float and double is unsigned infinity.
As previously quoted, the range of representable values is affected by
signed infinities. Was it meant to be affected by unsigned infinity
as well? For example, this affects whether int to float
conversions are defined when the int has a value greater than
FLT_MAX.
How does unsigned infinity work in comparisons? In particular, can unsigned infinity be negative by comparing less than zero?
The
isinfmacro determines whether its argument value is (positive or negative) infinity.
(C23 7.12.4.5 "The isinf macro" paragraph 2.)
Should isinf(INFINITY) be zero since it does not mention unsigned
infinity? Note that iszero says "(positive, negative, or unsigned)
zero" instead to clearly include unsigned zero.
Should %f with unsigned infinity contain a minus sign or not? Is it
unspecified? It appears the result of signbit(INFINITY) is
implementation-defined, so perhaps it should be
implementation-defined.