Topic: num_get::do_get and NaN


Author: Marc <marc.glisse@gmail.com>
Date: Mon, 30 Aug 2010 12:34:45 CST
Raw View
Hello,

for a double d, std::cout << d may print "nan", but std::cin >> d is
not allowed to read "nan" and store a nan in d (same thing with
infinity). This is discussed for instance at:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27904

[facet.num.get.virtuals] in n3126 apparently still contains the same
restriction.

I can understand leaving it as implementation defined behavior, but
actually forbidding it seems harmful (and I don't think it was done on
purpose).

I have been told (can't check myself) that IBM's compiler accepts to
read nan.

I couldn't find anything related on the LWG list of active issues
(1169 is only about overflow). Has there been any discussion about
this?

--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: Marc <marc.glisse@gmail.com>
Date: Thu, 16 Sep 2010 11:38:27 CST
Raw View
On 31 ao=FBt, 04:15, David Krauss <pot...@gmail.com> wrote:
> On Aug 30, 1:34 pm, Marc <marc.gli...@gmail.com> wrote:
>
> > I couldn't find anything related on the LWG list of active issues
> > (1169 is only about overflow). Has there been any discussion about
> > this?
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2022.pdf

Thank you for the link, I hadn't seen this paper. Maybe it looks too
much like a work in progress and wants to change too many things at
once, and therefore wasn't considered a priority. (a sentence in step
2 saying that the library may additionally accept some implementation
defined strings (accepted by strtold) would be enough for me, although
copying the C99 strtod specification would be best.)

> This paper is classified under "Evolution of proposals for C++0x -
> These papers are the inspiration or history behind the active or
> accepted proposals." However, it doesn't appear to be referenced by
> any other paper or DR.

It sounds strange for it to be classified as inspiration behind the
accepted or active proposals when no such proposal exists. Did it
somehow get misclassified and then forgotten? Or is that just the
default category where papers that don't qualify for the other
categories get dumped?

> For a fix, see floating_point_utilities_v3.zip (I have not tested):http:/=
/www.boostpro.com/vault/index.php?directory=Math%20-%20Numerics

Oh, I can write code to read "nan" :-) My concern is about having this
work by default for everyone.

Thanks again for your answer.

--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use
mailto:std-c++@netlab.cs.rpi.edu<std-c%2B%2B@netlab.cs.rpi.edu>
]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: David Krauss <potswa@gmail.com>
Date: Mon, 30 Aug 2010 20:15:42 CST
Raw View
On Aug 30, 1:34 pm, Marc <marc.gli...@gmail.com> wrote:

> I couldn't find anything related on the LWG list of active issues
> (1169 is only about overflow). Has there been any discussion about
> this?

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2022.pdf

This paper is classified under "Evolution of proposals for C++0x -
These papers are the inspiration or history behind the active or
accepted proposals." However, it doesn't appear to be referenced by
any other paper or DR.

For a fix, see floating_point_utilities_v3.zip (I have not tested):
http://www.boostpro.com/vault/index.php?directory=Math%20-%20Numerics


--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]