-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Reference (section label): [basic.fundamental]
Issue description
#include <complex>
auto c = std::polar(std::copysign(0.0, -1.0));If negative zero is negative, the Preconditions element of std::polar is not satisfied, and the behavior is undefined. However, the intent is for negative zero and positive zero to be largely interchangeable.
C23 5.2.4.2.2 [Characteristics of floating types <float.h>] clarifies as follows:
A value is negative if and only if it compares less than 0. Thus, negative zeros and NaNs are not negative values.
Library wording such as in [tab:format.sign] already treats negative zero as distinct from the negative numbers:
Indicates that a sign should be used for negative numbers and negative zero only (this is the default behavior).
Suggested resolution
Immediately prior to [basic.fundamental] paragraph 14, insert a new paragraph:
+? A value is negative if and only if it compares less than 0.
+Thus, negative zeros and NaNs are not negative values.
14 Integral and floating-point types are collectively termed arithmetic types.