`>>' can't read what `<<' produced: NaNs and Inf

Ulrich Drepper drepper@cygnus.com
Thu Dec 30 07:30:00 GMT 1999


Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr> writes:

> It is the ISO version of IEC 559 (formerly IEEE-754). ISO 14882 does
> not reference it directly as a normative part.

BUt ISO C 9x does and therefore it will have to be addressed.

> Typically, this will print "Infinity" or "Inf".
> What happens when a user tries to read back the output? Should we
> extend the langage so that extracting "Infinity" (or "Inf") be treated
> as a lexeme that happens to represent numeric_limits<double>::infinity()? 

Yes, definitely.  This is what the strtod() function in glibc does.

It also has to handle NaNs which can be written as

	NAN
	NAN(0x234)

or any case variations (the latter version determines the mantissa bits).

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------


More information about the Libstdc++ mailing list