delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/03/15/12:02:50

Message-Id: <200003151627.LAA20064@delorie.com>
From: "Dieter Buerssner" <buers AT gmx DOT de>
To: djgpp-workers AT delorie DOT com
Date: Wed, 15 Mar 2000 17:26:29 +0100
MIME-Version: 1.0
Subject: Re: Unnormals???
References: <200003151300 DOT IAA05344 AT delorie DOT com>
In-reply-to: <Pine.LNX.4.10.10003151444120.21378-100000@acp3bf>
X-mailer: Pegasus Mail for Win32 (v3.12b)
Reply-To: djgpp-workers AT delorie DOT com

On 15 Mar 00, at 15:05, Hans-Bernhard Broeker wrote:

[...]
> "inf", "infinity", "nan", or "nan{somestring}", where "{somestring}"
> is an implementation-defined string. 

So your interpretation differs with mine.
With your interpretation "nansqrt" would be correct, while I thought
the braces were not optional and it must be nan(sqrt).

> *If* an unnormal is a NaN, yes. The question still hovering in my head
> would then be what the difference is between a subnormal (supposed to
> be detectable by C99 functions) and an unnormal (mentioned nowhere in
> the whole draft). I remember having discussed this before, on this
> list, but not the details...
> 
> Subnormals as defined by C99 are fp numbers with smallest possible
> exponent, and a mantissa smaller than 0.5 (i.e. no leading one-bit).
> These can only happen for 'long double', indeed, as the other formats
> use a hidden leading one-bit for the mantissa.
 
Probably know already, what I write. Anyway...

For types float and double, every possible bit pattern is either a
normal number, a subnormal number, an Infinity, or a NaN, or zero.

This is  not true for type long double, because long double does not
have an implicit set msb in the mantissa. So there will be 
bitpatterns, with a finite exponent and a non set msb in the 
mantissa. We called those unnormal in this threat. They could in 
principle be renormalized (when the mantissa is not zero). But I 
think, they are just invalid. They are not numbers so we could
call them NaNs.

Using an invalid number probably produces undefined or at least 
implementation defined behaviour. Printing NaN would be
sensible implementation defined behaviour, as might be printing 
unnormal.

This is very similar to the example Eli mentioned about the
NULL-pointer for %s. Printing <null> can't be in contradiction to the 
Standard, because we deal with undefined behaviour.

This, at least is my *new* interpretation. It contradicts what I have 
said earlier ("unnormal" is not allowed). 

Perhaps there is a reader of this list, who has access to IEEE
floating point standards, and can check whether it allows an 
unnormalized mantissa with finite exponent for the extended
IEEE type.

Regards,
Dieter

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019