Re: strtod ("nan") returns negative NaN
- Date: Tue, 14 Aug 2018 22:08:41 +0100
- From: Andy Moreton <andrewjmoreton@xxxxxxxxx>
- Subject: Re: strtod ("nan") returns negative NaN
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 126.96.36.199.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."
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple