On Wed, 6 Nov 2013, N.M. Maclaren wrote:

> > > Yes, due to the poor quality of the IEEE 754 specifications.  In 1984,
> > > the distinction was left completely unspecified (even in intent).  In
> > > 2008, there is a recommendation (no more) that the top bit of the payload
> > > is used, with no specification of what to do if that is zero (which is
> > > the most obvious default).  That appears to be the Intel specification,
> > > though it may not have always been so even for x86.  I have certainly
> > > seen more than one convention for different architectures, but have no
> > > idea how many are extant nor how many are documented in the relevant
> > > architecture manuals.
> > 
> > In GCC, the qnan_msb_set bit of struct real_format is what specifies the
> > convention in use for a particular floating-point mode.
> 
> A single bit necessarily conveys at most one bit of information.
> That can indicate whether the MSB being zero is the criterion;
> it cannot indicate what the criterion is if that is not the case.

There are only two conventions relevant to systems supported by GCC: the 
one where MSB of 1 indicates quiet NaN and 0 indicates signaling NaN (most 
systems) and the reverse one, where MSB of 0 indicates quiet NaN and 1 
indicates signaling NaN (MIPS -mnan=legacy, HPPA).  (Plus a few formats 
with no NaNs at all, but there __builtin_issignaling can just evaluate its 
argument for its side effects and return 0, like __builtin_isnan does.)

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to