$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r73172 - trunk/libs/math/example
From: pbristow_at_[hidden]
Date: 2011-07-17 07:32:57
Author: pbristow
Date: 2011-07-17 07:32:57 EDT (Sun, 17 Jul 2011)
New Revision: 73172
URL: http://svn.boost.org/trac/boost/changeset/73172
Log:
Added negative NaN example.
Text files modified: 
   trunk/libs/math/example/nonfinite_facet_simple.cpp |     8 ++++++++                                
   1 files changed, 8 insertions(+), 0 deletions(-)
Modified: trunk/libs/math/example/nonfinite_facet_simple.cpp
==============================================================================
--- trunk/libs/math/example/nonfinite_facet_simple.cpp	(original)
+++ trunk/libs/math/example/nonfinite_facet_simple.cpp	2011-07-17 07:32:57 EDT (Sun, 17 Jul 2011)
@@ -84,6 +84,9 @@
   // and create a NaN (NotANumber)
   double NaN = +std::numeric_limits<double>::quiet_NaN ();
 
+  double negated_NaN = (boost::math::changesign)(std::numeric_limits<double>::quiet_NaN ());
+
+
   // Output the nonfinite values using the current (default C) locale.
   // The default representations differ from system to system,
   // for example, using Microsoft compilers, 1.#INF, -1.#INF, and 1.#QNAN.
@@ -91,6 +94,9 @@
   cout << "+std::numeric_limits<double>::infinity() = " << plus_infinity << endl;
   cout << "-std::numeric_limits<double>::infinity() = " << minus_infinity << endl;
   cout << "+std::numeric_limits<double>::quiet_NaN () = " << NaN << endl;
+
+  // Display negated NaN.
+  cout << "negated NaN " << negated_NaN << endl; // "-1.IND"
   
   // Create a new output locale, and add the nonfinite_num_put facet
   std::locale C99_out_locale (default_locale, new boost::math::nonfinite_num_put<char>);
@@ -106,6 +112,8 @@
   cout << "-std::numeric_limits<double>::infinity() = " << minus_infinity << endl;
   cout << "+std::numeric_limits<double>::quiet_NaN () = " << NaN << endl;
 
+  // Display negated NaN.
+  cout << "negated NaN " << negated_NaN << endl; // -nan
 
   // Create a string with the expected C99 representation of plus infinity.
   std::string inf = "inf";