On Tue, 14 Aug 2018 at 17:09, Andy Moreton <andrewjmore...@gmail.com> wrote: > > On Tue 14 Aug 2018, Steven Penny wrote: > > a number can be positive or negative. as "NaN" is by definition not a > > number, > > it cannot be positive or negative, it is simply itself, something anathema > > to > > a number. > > The C standard disagrees with you [ISO:IEC 9899:2011, section 5.2.4.2.2]: > > "An implementation may give zero and values that are not floating-point > numbers (such as infinities and NaNs) a sign or may leave them unsigned. > Wherever such values are unsigned, any requirement in this International > Standard to retrieve the sign shall produce an unspecified sign, and any > requirement to set the sign shall be ignored." >
Does it disagree? I would say it did if it said MUST.. but it says MAY I thought usually meant "be consistent with what you think is right for your environment but yeah whatever". And one can read the "any requirement to set the sign shall be ignored" as being -NaN should come back as NaN. I don't know how this is also affected by https://en.wikipedia.org/wiki/ISO/IEC_10967 which goes to the IEEE 754 NaN is not a number (except when it is). [ It looks from my layman point of view that Cygwin is ok with sending whatever they want back if it is implementation defined. However the bigger case is whether they want to be similar to how the other environments report things. Currently Cygwin reports -NaN for positive NaN and 'NaN' for '-NaN'.. which may be ok but doesn't match the other environments which all report NaN. [Does that make sense?] > AndyM > > > -- > Problem reports: http://cygwin.com/problems.html > FAQ: http://cygwin.com/faq/ > Documentation: http://cygwin.com/docs.html > Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple > -- Stephen J Smoogen. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple