This is the mail archive of the
mailing list for the libstdc++ project.
Re: `>>' can't read what `<<' produced: NaNs and Inf
- To: Benjamin Kosnik <email@example.com>
- Subject: Re: `>>' can't read what `<<' produced: NaNs and Inf
- From: Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
- Date: 31 Mar 1999 02:20:08 +0200
- Cc: Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>, Joao Cardoso <firstname.lastname@example.org>, email@example.com
- Organization: CMLA, ENS Cachan -- CNRS URA 1611 (France)
- References: <Pine.LNX.3.96.990330134118.32501Afirstname.lastname@example.org>
Benjamin Kosnik <email@example.com> writes:
| > | not numbers (NaN) or are infinity (Inf).
| > | However, `>>' can't read those tokens. Is this deliberate?
| > I don't think so. Personnally, I came accross, a few days ago, the
| > question of whether libtsdc++ should allow this or not--that was when
| > reading LIA-1. A quick look at clause 2 (Lexical conventions) lets me
| > under the impression that allowing reading NaN, Inf or so should be
| > flagged as extensions.
| Gaby, what is LIA-1? Eeeek. I can't find a part of 14882 that deals with
| this issue--an oversight? Or am I blind? Does this need to get forwarded
| to the library issues list?
I've just realized my earlier mail was not clear. Sorry for that.
LIA-1 is a short for
Information technology -- Language independent arithmetic --
Part 1: integer and floating point arithmetic.
It is the ISO version of IEC 559 (formerly IEEE-754). ISO 14882 does
not reference it directly as a normative part. But it does indirectly
in the definition of semantics of numeric_limits<> members. It does
also refer to it in a non normative form (footnotes) but that is not
Assume numeric_limits<double>::is_iec559 is true. Consider:
cout << numeric_limits<double>::infinity();
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()?
Similar questions for NaN. There is also the issue of whether such an
extension is a conforming one.
| > My inclination will be to get it into lidstc++ as an extension. Does
| > anyone have another idea ?
| Good idea. I say we either wrap this stuff with a suitable macro from
| bits/c++config.h, such as:
| // Use corrected code from the committee library group's issues list.
| #define _G_RESOLVE_LIB_DEFECTS 1
| Or make some other (documented) macro guard to turn on and off this
| I would like to have this functionality though, in some form. I would also
| like to do the relevant reading, so I'd appreciate any pointers. . .
I know LIA-1 is publically available on the net. I'll try to find out
the link and reference it in the docs section.