Date: Sat, 27 Dec 2014 18:00:29 -0500 From: Garrett Wollman <wollman@csail.mit.edu> To: Bruce Evans <brde@optusnet.com.au> Cc: Pedro Giffuni <pfg@freebsd.org>, freebsd-standards@freebsd.org Subject: Re: Does posix say anything about the sign in NaNs ? Message-ID: <21663.14861.388944.805245@khavrinen.csail.mit.edu> In-Reply-To: <20141225235228.H927@besplex.bde.org> References: <549B1115.8000909@FreeBSD.org> <20141225235228.H927@besplex.bde.org>
index | next in thread | previous in thread | raw e-mail
<<On Fri, 26 Dec 2014 01:00:48 +1100 (EST), Bruce Evans <brde@optusnet.com.au> said: > On Wed, 24 Dec 2014, Pedro Giffuni wrote: >> I got the attached patch from OpenBSD. >> >> It says: >> ____ >> Show the sign for NaN as per POSIX; from Elliott Hughes. >> ok martynas@, millert@, doug@ >> ____ >> >> I can't find a reference in POSIX documentation to support it though. > The behaviour is implementation-defined. From n869.txt for printf: An old draft of the C standard is not necessarily relevant here, since POSIX may place requirements on implementations beyond those of C. The 2008 POSIX standard (aka SUSv7) had this to say (XBD7 p. 247, <float.h>): An implementation may give zero and non-numeric values, such as infinities and NaNs, a sign, or may leave them unsigned. Wherever such values are unsigned, any requirement in POSIX.1-2008 to retrieve the sign shall produce an unspecified sign and any requirement to set the sign shall be ignored. I haven't checked the current edition to see whether it differs in this regard, but I doubt it. XSH7 page 932 (fscanf()) additionally requires: If the fprintf ( ) family of functions generates character string representations for infinity and NaN (a symbolic entity encoded in floating-point format) to support IEEE Std 754-1985, the fscanf ( ) family of functions shall recognize them as input. My view would be that FreeBSD is free to determine that NaN is an unsigned value, and no conforming application can distinguish signed NaNs (either positive or negative) from unsigned NaNs. -GAWollmanhelp
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?21663.14861.388944.805245>
