From 83639bd9aee73ef88ea9c9aba075ba427287ce99 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Sun, 26 Feb 2012 09:19:55 +0000 Subject: [PATCH] Fixes #6571 (documentation update, added 'why lexical_cast does not understand "-1.#IND"' question and answer to it) [SVN r77118] --- doc/lexical_cast.qbk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/doc/lexical_cast.qbk b/doc/lexical_cast.qbk index 5d45446..4ad8336 100644 --- a/doc/lexical_cast.qbk +++ b/doc/lexical_cast.qbk @@ -167,6 +167,14 @@ if a negative number is read, no errors will arise and the result will be the tw `boost::lexical_cast` sees single `wchar_t` character as `unsigned short`. It is not a `boost::lexical_cast` mistake, but a limitation of compiler options that you use. +[pre +] + +* [*Question:] Why `boost::lexical_cast("-1.#IND");` throws `boost::bad_lexical_cast`? + * [*Answer:] `"-1.#IND"` is a compiler extension, that violates standard. You shall input `"-nan"`, `"nan"`, `"inf"` +, `"-inf"` (case insensitive) strings to get NaN and Inf values. `boost::lexical_cast` outputs `"-nan"`, `"nan"`, +`"inf"`, `"-inf"` strings, when has NaN or Inf input values. + [endsect] [section Changes]