X-Authentication-Warning: acp3bf.physik.rwth-aachen.de: broeker owned process doing -bs Date: Fri, 17 Mar 2000 13:16:51 +0100 (MET) From: Hans-Bernhard Broeker X-Sender: broeker AT acp3bf To: djgpp-workers AT delorie DOT com Subject: Re: Unnormals??? In-Reply-To: <38D15771.85A4776@cyberoptics.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com Errors-To: dj-admin AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Thu, 16 Mar 2000, Eric Rudd wrote: > Hans-Bernhard Broeker wrote: > The NaN without the sign bit set is a "signaling NaN". No, it isn't. The sign bit is not the one that distinguishes between signaling and quiet NaN. The second bit of the mantissa does that. In a nutshell (the leading '1.' in the mantissa is the hidden one in 'float' and 'double', that only exists visibly in 'long double' and the FPU registers): Inf := exponent maximal (all bits 1) && mantissa is 1.000.... NaN := exponent maximal (all bits 1) && mantissa is anything but 1.000... SNaN := NaN && mantissa is of form 1.0xxx... QNaN := NaN && mantissa is of form 1.1xxx... 'real indefinite' := QNaN && mantissa is 1.1000... && sign bit is set > If we call "real indefinite" -NaN, then we have > > -NaN * SNaN => SNaN > SNaN * SNaN => SNaN > -NaN * -NaN => -NaN The first two will actually yield QNaN, as we mask invalid operation exceptions, which causes the FPU to automatically convert any SNaN to a QNaN, and go on. The third one is where the trouble lies: I have no documentation about what happens to the sign bits of operands in such operation with NaN, it seems. Anyone? Or will we have to do an experiment? > I would vote for suppressing the sign of NaN except when it is > explicitly specified in a format specifier (as is currently done) > since, as I argue above, "real indefinite" is not really negative. The C99 explicitly mentions signs of NaNs in its output specification for *printf(), and also in strtod()/*scanf() input. I don't think we can just say the a NaN with the sign bit set is *not* negative. Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.