$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r71379 - trunk/libs/math/example
From: pbristow_at_[hidden]
Date: 2011-04-19 13:59:47
Author: pbristow
Date: 2011-04-19 13:59:46 EDT (Tue, 19 Apr 2011)
New Revision: 71379
URL: http://svn.boost.org/trac/boost/changeset/71379
Log:
Tabs removed, end newlines added, and max/min () to meet inspection report comments.
Text files modified: 
   trunk/libs/math/example/inspect_fp.cpp                    |   106 ++++++++++++++++++++--------------------
   trunk/libs/math/example/inverse_gaussian_example.cpp      |    80 +++++++++++++++---------------          
   trunk/libs/math/example/lexical_cast_nonfinite_facets.cpp |     9 +-                                      
   trunk/libs/math/example/nonfinite_facet_sstream.cpp       |    56 ++++++++++----------                    
   trunk/libs/math/example/nonfinite_legacy.cpp              |    36 ++++++------                            
   trunk/libs/math/example/nonfinite_loopback_ok.cpp         |    14 ++--                                    
   trunk/libs/math/example/nonfinite_signaling_NaN.cpp       |    48 +++++++++---------                      
   trunk/libs/math/example/test_nonfinite_loopback.cpp       |    20 +++---                                  
   8 files changed, 184 insertions(+), 185 deletions(-)
Modified: trunk/libs/math/example/inspect_fp.cpp
==============================================================================
--- trunk/libs/math/example/inspect_fp.cpp	(original)
+++ trunk/libs/math/example/inspect_fp.cpp	2011-04-19 13:59:46 EDT (Tue, 19 Apr 2011)
@@ -164,61 +164,61 @@
 Sample output on an AMD Quadcore running MSVC 10
 
   Processor: x86 or x64
-  
+
   This platform is little-endian.
   BOOST_LITTTLE_ENDIAN is defined.
-  
+
   ---------- float --------------------
-  
-  0         00 00 00 00 
-  sn.min    00 00 00 01 
-  -sn.min   80 00 00 01 
-  n.min/256 00 00 80 00 
-  n.min/2   00 40 00 00 
-  -n.min/2  80 40 00 00 
-  n.min     00 80 00 00 
-  1         3f 80 00 00 
-  3/4       3f 40 00 00 
-  4/3       3f aa aa ab 
-  max       7f 7f ff ff 
-  inf       7f 80 00 00 
-  q.nan     7f c0 00 00 
-  s.nan     7f c0 00 01 
-  
-  
+
+  0         00 00 00 00
+  sn.min    00 00 00 01
+  -sn.min   80 00 00 01
+  n.min/256 00 00 80 00
+  n.min/2   00 40 00 00
+  -n.min/2  80 40 00 00
+  n.min     00 80 00 00
+  1         3f 80 00 00
+  3/4       3f 40 00 00
+  4/3       3f aa aa ab
+  max       7f 7f ff ff
+  inf       7f 80 00 00
+  q.nan     7f c0 00 00
+  s.nan     7f c0 00 01
+
+
   ---------- double -------------------
-  
-  0         00 00 00 00 00 00 00 00 
-  sn.min    00 00 00 00 00 00 00 01 
-  -sn.min   80 00 00 00 00 00 00 01 
-  n.min/256 00 00 10 00 00 00 00 00 
-  n.min/2   00 08 00 00 00 00 00 00 
-  -n.min/2  80 08 00 00 00 00 00 00 
-  n.min     00 10 00 00 00 00 00 00 
-  1         3f f0 00 00 00 00 00 00 
-  3/4       3f e8 00 00 00 00 00 00 
-  4/3       3f f5 55 55 55 55 55 55 
-  max       7f ef ff ff ff ff ff ff 
-  inf       7f f0 00 00 00 00 00 00 
-  q.nan     7f f8 00 00 00 00 00 00 
-  s.nan     7f f8 00 00 00 00 00 01 
-  
-  
+
+  0         00 00 00 00 00 00 00 00
+  sn.min    00 00 00 00 00 00 00 01
+  -sn.min   80 00 00 00 00 00 00 01
+  n.min/256 00 00 10 00 00 00 00 00
+  n.min/2   00 08 00 00 00 00 00 00
+  -n.min/2  80 08 00 00 00 00 00 00
+  n.min     00 10 00 00 00 00 00 00
+  1         3f f0 00 00 00 00 00 00
+  3/4       3f e8 00 00 00 00 00 00
+  4/3       3f f5 55 55 55 55 55 55
+  max       7f ef ff ff ff ff ff ff
+  inf       7f f0 00 00 00 00 00 00
+  q.nan     7f f8 00 00 00 00 00 00
+  s.nan     7f f8 00 00 00 00 00 01
+
+
   ---------- long double --------------
-  
-  0         00 00 00 00 00 00 00 00 
-  sn.min    00 00 00 00 00 00 00 01 
-  -sn.min   80 00 00 00 00 00 00 01 
-  n.min/256 00 00 10 00 00 00 00 00 
-  n.min/2   00 08 00 00 00 00 00 00 
-  -n.min/2  80 08 00 00 00 00 00 00 
-  n.min     00 10 00 00 00 00 00 00 
-  1         3f f0 00 00 00 00 00 00 
-  3/4       3f e8 00 00 00 00 00 00 
-  4/3       3f f5 55 55 55 55 55 55 
-  max       7f ef ff ff ff ff ff ff 
-  inf       7f f0 00 00 00 00 00 00 
-  q.nan     7f f8 00 00 00 00 00 00 
-  s.nan     7f f8 00 00 00 00 00 01 
-  
-  */
\ No newline at end of file
+
+  0         00 00 00 00 00 00 00 00
+  sn.min    00 00 00 00 00 00 00 01
+  -sn.min   80 00 00 00 00 00 00 01
+  n.min/256 00 00 10 00 00 00 00 00
+  n.min/2   00 08 00 00 00 00 00 00
+  -n.min/2  80 08 00 00 00 00 00 00
+  n.min     00 10 00 00 00 00 00 00
+  1         3f f0 00 00 00 00 00 00
+  3/4       3f e8 00 00 00 00 00 00
+  4/3       3f f5 55 55 55 55 55 55
+  max       7f ef ff ff ff ff ff ff
+  inf       7f f0 00 00 00 00 00 00
+  q.nan     7f f8 00 00 00 00 00 00
+  s.nan     7f f8 00 00 00 00 00 01
+
+  */
Modified: trunk/libs/math/example/inverse_gaussian_example.cpp
==============================================================================
--- trunk/libs/math/example/inverse_gaussian_example.cpp	(original)
+++ trunk/libs/math/example/inverse_gaussian_example.cpp	2011-04-19 13:59:46 EDT (Tue, 19 Apr 2011)
@@ -8,7 +8,7 @@
 // or copy at http://www.boost.org/LICENSE_1_0.txt)
 
 // Example of using the Inverse Gaussian (or Inverse Normal) distribution.
-// The Wald Distribution is 
+// The Wald Distribution is
 
 
 // Note that this file contains Quickbook mark-up as well as code
@@ -72,22 +72,22 @@
       cout.precision(17); // std::numeric_limits<double>::max_digits10; for 64-bit doubles.
 
      // Traditional tables and values.
-     double step = 0.2; // in z 
+     double step = 0.2; // in z
       double range = 4; // min and max z = -range to +range.
       // Construct a (standard) inverse gaussian distribution s
-      inverse_gaussian w11(1, 1); 
+      inverse_gaussian w11(1, 1);
       // (default mean = units, and standard deviation = unity)
       cout << "(Standard) Inverse Gaussian distribution, mean = "<< w11.mean()
           << ", scale = " << w11.scale() << endl;
 
 /*` First the probability distribution function (pdf).
- */ 
+ */
       cout << "Probability distribution function (pdf) values" << endl;
       cout << "  z " "      pdf " << endl;
       cout.precision(5);
       for (double z = (numeric_limits<double>::min)(); z < range + step; z += step)
       {
-        cout << left << setprecision(3) << setw(6) << z << " " 
+        cout << left << setprecision(3) << setw(6) << z << " "
           << setprecision(precision) << setw(12) << pdf(w11, z) << endl;
       }
       cout.precision(6); // default
@@ -100,13 +100,13 @@
       cout << "  z " "      cdf " << endl;
       for (double z = (numeric_limits<double>::min)(); z < range + step; z += step)
       {
-        cout << left << setprecision(3) << setw(6) << z << " " 
+        cout << left << setprecision(3) << setw(6) << z << " "
           << setprecision(precision) << setw(12) << cdf(w11, z) << endl;
       }
       /*`giving the following table:
 [pre
-    z       pdf 
-  2.23e-308 -1.#IND     
+    z       pdf
+  2.23e-308 -1.#IND
   0.2    0.90052111680384117
   0.4    1.0055127039453111
   0.6    0.75123750098955733
@@ -127,9 +127,9 @@
   3.6    0.022840312999395804
   3.8    0.019196657941016954
   4      0.016189699458236451
-  Integral (area under the curve) from 0 up to z (cdf) 
-    z       cdf 
-  2.23e-308 0           
+  Integral (area under the curve) from 0 up to z (cdf)
+    z       cdf
+  2.23e-308 0
   0.2    0.063753567519976254
   0.4    0.2706136704424541
   0.6    0.44638391340412931
@@ -152,7 +152,7 @@
   4      0.97907636417888622
 ]
 
-/*`We can get the inverse, the quantile, percentile, percentage point, or critical value 
+/*`We can get the inverse, the quantile, percentile, percentage point, or critical value
 for a probability for a few probability from the above table, for z = 0.4, 1.0, 2.0:
 */
       cout << quantile(w11, 0.27061367044245421 ) << endl; // 0.4
@@ -174,7 +174,7 @@
 
     // formatC(SuppDists::qinvGauss(0.3649755481729598, 1, 1), digits=17)  [1] "0.50000000969034875"
 
-           
+
 
   // formatC(SuppDists::dinvGauss(0.01, 1, 1), digits=17) [1] "2.0811768202028392e-19"
   // formatC(SuppDists::pinvGauss(0.01, 1, 1), digits=17) [1] "4.122313403318778e-23"
@@ -193,12 +193,12 @@
   //double p = pdf(w11, x);
   //double c = cdf(w11, x); // cdf(1, 1, 1) = 0.66810200122317065
   //cout << "cdf(" << x << ", " << w11.mean() << ", "<< w11.scale() << ") = " << c << endl; // cdf(x, 1, 1) 0.27061367044245421
-  //cout << "pdf(" << x << ", " << w11.mean() << ", "<< w11.scale() << ") = " << p << endl; 
+  //cout << "pdf(" << x << ", " << w11.mean() << ", "<< w11.scale() << ") = " << p << endl;
   //double q = quantile(w11, c);
   //cout << "quantile(w11, " << c <<  ") = " << q << endl;
 
   //cout  << "quantile(w11, 4.122313403318778e-23) = "<< quantile(w11, 4.122313403318778e-23) << endl; // quantile
-  //cout << "quantile(w11, 4.8791443010851493e-219) = " << quantile(w11, 4.8791443010851493e-219) << endl; // quantile 
+  //cout << "quantile(w11, 4.8791443010851493e-219) = " << quantile(w11, 4.8791443010851493e-219) << endl; // quantile
 
   //double c1 = 1 - cdf(w11, x); //  1 - cdf(1, 1, 1) = 0.33189799877682935
   //cout << "1 - cdf(" << x << ", " << w11.mean() << ", " << w11.scale() << ") = " << c1 << endl; // cdf(x, 1, 1) 0.27061367044245421
@@ -210,7 +210,7 @@
   //cout << "quantile(w11, " << c << ") = "<< quantile(w11, c) << endl; // quantile = 0.99999999999999978 == x = 1
   //cout << "quantile(w11, " << c << ") = "<< quantile(w11, 1 - c) << endl; // quantile complement. quantile(w11, 0.66810200122317065) = 0.46336593652340152
 //  cout << "quantile(complement(w11, " << c << ")) = " << quantile(complement(w11, c)) << endl; // quantile complement                = 0.46336593652340163
-  
+
   // cdf(1, 1, 1) = 0.66810200122317065
   // 1 - cdf(1, 1, 1) = 0.33189799877682935
   // cdf(complement(1, 1, 1)) = 0.33189799877682929
@@ -219,21 +219,21 @@
   // 1 - quantile(w11, 0.66810200122317065) = 2.2204460492503131e-016
   // quantile(complement(w11, 0.33189799877682929)) = 0.99999999999999989
 
- 
+
   // qinvgauss(c, 1, 1) = 0.3999999999999998
   // SuppDists::qinvGauss(0.270613670442454, 1, 1) [1] 0.4
- 
+
 
   /*
-  double qs = pinvgaussU(c, 1, 1); // 
+  double qs = pinvgaussU(c, 1, 1); //
     cout << "qinvgaussU(c, 1, 1) = " << qs << endl; // qinvgaussU(c, 1, 1) = 0.86567442459240929
-    // > z=q - exp(c) * p [1] 0.8656744 qs 0.86567442459240929	double
+    // > z=q - exp(c) * p [1] 0.8656744 qs 0.86567442459240929 double
     // Is this the complement?
     cout << "qgamma(0.2, 0.5, 1) expect 0.0320923 = " << qgamma(0.2, 0.5, 1) << endl;
     // qgamma(0.2, 0.5, 1) expect 0.0320923 = 0.032092377333650807
 
-  
-  cout << "qinvgauss(pinvgauss(x, 1, 1) = " << q 
+
+  cout << "qinvgauss(pinvgauss(x, 1, 1) = " << q
   << ", diff = " << x - q << ", fraction = " << (x - q) /x << endl; // 0.5
 
  */   // > SuppDists::pinvGauss(0.02, 1,1)  [1] 4.139176e-12
@@ -241,15 +241,15 @@
 
 
     // pinvGauss(1,1,1) = 0.668102  C++  == 0.66810200122317065
-  // qinvGauss(0.668102,1,1) = 1 
+  // qinvGauss(0.668102,1,1) = 1
 
    //  SuppDists::pinvGauss(0.3,1,1) = 0.1657266
   // cout << "qinvGauss(0.0040761113207110162, 1, 1) = " << qinvgauss(0.0040761113207110162, 1, 1) << endl;
   //cout << "quantile(s, 0.1657266) = " << quantile(s, 0.1657266) << endl; // expect 1.
 
-  //wald s12(2, 1); 
+  //wald s12(2, 1);
   //cout << "qinvGauss(0.3, 2, 1) = " << qinvgauss(0.3, 2, 1) << endl; // SuppDists::qinvGauss(0.3,2,1) == 0.58288065635052944
-  //// but actually get qinvGauss(0.3, 2, 1) = 0.58288064777632187  
+  //// but actually get qinvGauss(0.3, 2, 1) = 0.58288064777632187
   //cout  << "cdf(s12, 0.3) = " << cdf(s12, 0.3) << endl; //  cdf(s12, 0.3) = 0.10895339868447573
 
  // using boost::math::wald;
@@ -295,8 +295,8 @@
     cout.precision(6); // Restore to default.
   } // try
   catch(const std::exception& e)
-  { // Always useful to include try & catch blocks because default policies 
-    // are to throw exceptions on arguments that cause errors like underflow, overflow. 
+  { // Always useful to include try & catch blocks because default policies
+    // are to throw exceptions on arguments that cause errors like underflow, overflow.
     // Lacking try & catch blocks, the program will abort without a message below,
     // which may give some helpful clues as to the cause of the exception.
     std::cout <<
@@ -309,14 +309,14 @@
 /*
 
 Output is:
- 
+
 inverse_gaussian_example.cpp
   inverse_gaussian_example.vcxproj -> J:\Cpp\MathToolkit\test\Math_test\Debug\inverse_gaussian_example.exe
   Example: Inverse Gaussian Distribution.
   (Standard) Inverse Gaussian distribution, mean = 1, scale = 1
   Probability distribution function (pdf) values
-    z       pdf 
-  2.23e-308 -1.#IND     
+    z       pdf
+  2.23e-308 -1.#IND
   0.2    0.90052111680384117
   0.4    1.0055127039453111
   0.6    0.75123750098955733
@@ -337,9 +337,9 @@
   3.6    0.022840312999395804
   3.8    0.019196657941016954
   4      0.016189699458236451
-  Integral (area under the curve) from 0 up to z (cdf) 
-    z       cdf 
-  2.23e-308 0           
+  Integral (area under the curve) from 0 up to z (cdf)
+    z       cdf
+  2.23e-308 0
   0.2    0.063753567519976254
   0.4    0.2706136704424541
   0.6    0.44638391340412931
@@ -377,33 +377,33 @@
 > SuppDists::dinvGauss(0.3, 1, 1) [1] 1.072888
 > SuppDists::dinvGauss(0.1, 1, 1) [1] 0.2197948
 > SuppDists::dinvGauss(0.2, 1, 1) [1] 0.9005211
-> 
+>
 x = 0.3 [1, 1] 1.0728879234594337  // R SuppDists::dinvGauss(0.3, 1, 1) [1] 1.072888
 
 x = 1   [1, 1] 0.3989422804014327
 
 
- 0 "                NA"  
+ 0 "                NA"
  1 "0.3989422804014327"
- 2 "0.10984782236693059"   
+ 2 "0.10984782236693059"
  3 "0.039418357969819733"
  4 "0.016189699458236468"
- 5 "0.007204168934430732"  
- 6 "0.003379893528659049" 
+ 5 "0.007204168934430732"
+ 6 "0.003379893528659049"
  7 "0.0016462878258114036"
  8 "0.00082460931140859956"
  9 "0.00042207355643694234"
 10 "0.00021979480031862676"
 
 
-[1] "                NA"     " 0.690988298942671"     "0.11539974210409144"   
+[1] "                NA"     " 0.690988298942671"     "0.11539974210409144"
  [4] "0.01799698883772935"    "0.0029555399206496469"  "0.00050863023587406587"
  [7] "9.0761842931362914e-05" "1.6655279133132795e-05" "3.1243174913715429e-06"
 [10] "5.96530227727434e-07"   "1.1555606328299836e-07"
 
 
 matC(dinvGauss(0:10, 1, 3), digits=17)  df = 3
-[1] "                NA"     " 0.690988298942671"     "0.11539974210409144"   
+[1] "                NA"     " 0.690988298942671"     "0.11539974210409144"
  [4] "0.01799698883772935"    "0.0029555399206496469"  "0.00050863023587406587"
  [7] "9.0761842931362914e-05" "1.6655279133132795e-05" "3.1243174913715429e-06"
 [10] "5.96530227727434e-07"   "1.1555606328299836e-07"
Modified: trunk/libs/math/example/lexical_cast_nonfinite_facets.cpp
==============================================================================
--- trunk/libs/math/example/lexical_cast_nonfinite_facets.cpp	(original)
+++ trunk/libs/math/example/lexical_cast_nonfinite_facets.cpp	2011-04-19 13:59:46 EDT (Tue, 19 Apr 2011)
@@ -64,7 +64,7 @@
 int main ()
 {
   std::cout << "finite_num_facet with lexical_cast example." << std::endl;
-   
+
   // Example of using non_finite num_put and num_get facets with lexical_cast.
   locale old_locale;
   locale tmp_locale(old_locale, new nonfinite_num_put<char>);
@@ -74,7 +74,7 @@
   // Create a new output locale (from the tmp locale), and add the input nonfinite_num_get facet.
 
   // Note that is necessary to do add get and put facets in two steps.
- 
+
   locale::global(new_locale); // Newly constructed streams
   // (including those streams inside lexical_cast)
   // now use new_locale with nonfinite facets.
@@ -118,10 +118,9 @@
 Output:
 
   finite_num_facet with lexical_cast example.
-  Using C99_out_locale 
+  Using C99_out_locale
   +std::numeric_limits<double>::infinity() = inf
   -std::numeric_limits<double>::infinity() = -inf
   +std::numeric_limits<double>::quiet_NaN () = nan
 
-
-*/
\ No newline at end of file
+*/
Modified: trunk/libs/math/example/nonfinite_facet_sstream.cpp
==============================================================================
--- trunk/libs/math/example/nonfinite_facet_sstream.cpp	(original)
+++ trunk/libs/math/example/nonfinite_facet_sstream.cpp	2011-04-19 13:59:46 EDT (Tue, 19 Apr 2011)
@@ -30,9 +30,9 @@
 using std::locale;
 
 #include <sstream>
-  using std::stringstream;
-  using std::istringstream;
-  using std::ostringstream;
+using std::stringstream;
+using std::istringstream;
+using std::ostringstream;
 
 #include <limits>
 using std::numeric_limits;
@@ -41,70 +41,70 @@
 
 int main()
 {
-//[nonfinite_facets_sstream_1
+  //[nonfinite_facets_sstream_1
   locale old_locale;
   locale tmp_locale(old_locale, new nonfinite_num_put<char>);
   locale new_locale(tmp_locale, new nonfinite_num_get<char>);
-//] [/nonfinite_facets_sstream_1]
+  //] [/nonfinite_facets_sstream_1]
 
   // Note that to add two facets,  nonfinite_num_put and nonfinite_num_get,
   // you have to add one at a time, using a temporary locale.
 
   {
     ostringstream oss;
-	  oss.imbue(new_locale);
+    oss.imbue(new_locale);
     double inf = numeric_limits<double>::infinity();
-	  oss << inf; // Write out.
+    oss << inf; // Write out.
     cout << "infinity output was " << oss.str() << endl;
-	  assert(oss.str() == "inf"); 
+    assert(oss.str() == "inf");
   }
-   {
+  {
     istringstream iss;
     iss.str("inf");
-	  iss.imbue(new_locale);
+    iss.imbue(new_locale);
     double inf;
-	  iss >> inf; // Read from "inf"
+    iss >> inf; // Read from "inf"
     cout << "Infinity input was " << iss.str() << endl;
-	  assert(inf == numeric_limits<double>::infinity()); 
+    assert(inf == numeric_limits<double>::infinity());
   }
 
   {
-//[nonfinite_facets_sstream_2
+    //[nonfinite_facets_sstream_2
     stringstream ss;
     ss.imbue(new_locale);
     double inf = numeric_limits<double>::infinity();
     ss << inf; // Write out.
     assert(ss.str() == "inf");
-        double r;
+    double r;
     ss >> r; // Read back in.
     assert(inf == r); // Confirms that the double values really are identical.
 
     cout << "infinity output was " << ss.str() << endl;
     cout << "infinity input was " << r << endl;
     // But the string representation of r displayed will be the native type
-    // because, when it was constructed, cout had NOT been imbued 
+    // because, when it was constructed, cout had NOT been imbued
     // with the new locale containing the nonfinite_numput facet.
     // So the cout output will be "1.#INF on MS platforms
     // and may be "inf" or other string representation on other platforms.
-   
-//] [/nonfinite_facets_sstream_2]
+
+    //] [/nonfinite_facets_sstream_2]
   }
 
   {
     stringstream ss;
-	  ss.imbue(new_locale);
+    ss.imbue(new_locale);
 
     double nan = numeric_limits<double>::quiet_NaN();
-	  ss << nan; // Write out.
+    ss << nan; // Write out.
     assert(ss.str() == "nan");
 
-	  double v;
-	  ss >> v; // Read back in.
+    double v;
+    ss >> v; // Read back in.
 
     cout << "NaN output was " << ss.str() << endl;
     cout << "NaN input was " << v << endl;
 
-	  // assert(nan == v); // Always fails because NaN == NaN fails!
+    // assert(nan == v); // Always fails because NaN == NaN fails!
     // assert(nan == numeric_limits<double>::quiet_NaN()); asserts!
 
     // And the string representation will be the native type
@@ -120,12 +120,12 @@
 /*
 //[nonfinite_facet_sstream_output
 
-  infinity output was inf
-  Infinity input was inf
-  infinity output was inf
-  infinity input was 1.#INF
-  NaN output was nan
-  NaN input was 1.#QNAN
+infinity output was inf
+Infinity input was inf
+infinity output was inf
+infinity input was 1.#INF
+NaN output was nan
+NaN input was 1.#QNAN
 
 //] [nonfinite_facet_sstream_output]
 */
Modified: trunk/libs/math/example/nonfinite_legacy.cpp
==============================================================================
--- trunk/libs/math/example/nonfinite_legacy.cpp	(original)
+++ trunk/libs/math/example/nonfinite_legacy.cpp	2011-04-19 13:59:46 EDT (Tue, 19 Apr 2011)
@@ -32,7 +32,7 @@
 using std::locale;
 
 #include <sstream>
-  using std::stringstream;
+using std::stringstream;
 #include <limits>
 using std::numeric_limits;
 
@@ -40,39 +40,39 @@
 
 int main()
 {
- 
+
   locale old_locale;
-	locale tmp_locale(old_locale, new nonfinite_num_put<char>(legacy));
-	locale new_locale(tmp_locale, new nonfinite_num_get<char>(legacy));
+  locale tmp_locale(old_locale, new nonfinite_num_put<char>(legacy));
+  locale new_locale(tmp_locale, new nonfinite_num_get<char>(legacy));
   // Note that to add two facets,  nonfinite_num_put and nonfinite_num_get,
   // you have to add one at a time, using a temporary locale.
 
   {
     stringstream ss;
-	  ss.imbue(new_locale);
+    ss.imbue(new_locale);
     double inf = numeric_limits<double>::infinity();
-	  ss << inf; // Write out.
-	  double r;
-	  ss >> r; // Read back in.
+    ss << inf; // Write out.
+    double r;
+    ss >> r; // Read back in.
 
     cout << "infinity output was " << inf << endl;
     cout << "infinity input was " << r << endl;
 
-	  assert(inf == r); 
+    assert(inf == r); 
   }
   {
     stringstream ss;
-	  ss.imbue(new_locale);
+    ss.imbue(new_locale);
 
     double nan = numeric_limits<double>::quiet_NaN();
-	  ss << nan; // Write out.
-	  double v;
-	  ss >> v; // Read back in.
+    ss << nan; // Write out.
+    double v;
+    ss >> v; // Read back in.
 
     cout << "NaN output was " << nan << endl;
     cout << "NaN input was " << v << endl;
 
-	  // assert(nan == v); // Always fails because NaN == NaN fails!
+    // assert(nan == v); // Always fails because NaN == NaN fails!
     // assert(nan == numeric_limits<double>::quiet_NaN()); asserts!
   }
 
@@ -82,10 +82,10 @@
 
 Output:
 
-  infinity output was 1.#INF
-  infinity input was 1.#INF
-  NaN output was 1.#QNAN
-  NaN input was 1.#QNAN
+infinity output was 1.#INF
+infinity input was 1.#INF
+NaN output was 1.#QNAN
+NaN input was 1.#QNAN
 
 */
 
Modified: trunk/libs/math/example/nonfinite_loopback_ok.cpp
==============================================================================
--- trunk/libs/math/example/nonfinite_loopback_ok.cpp	(original)
+++ trunk/libs/math/example/nonfinite_loopback_ok.cpp	2011-04-19 13:59:46 EDT (Tue, 19 Apr 2011)
@@ -32,7 +32,7 @@
 using std::locale;
 
 #include <sstream>
-  using std::stringstream;
+using std::stringstream;
 #include <limits>
 using std::numeric_limits;
 
@@ -50,10 +50,10 @@
   stringstream ss; // Both input and output.
   ss.imbue(new_locale);
 
-	double inf = numeric_limits<double>::infinity();
-	ss << inf; // Write out.
-	double r;
-	ss >> r; // Read back in.
+  double inf = numeric_limits<double>::infinity();
+  ss << inf; // Write out.
+  double r;
+  ss >> r; // Read back in.
 
   assert(inf == r); // OK MSVC <= 10.0!
 
@@ -63,8 +63,8 @@
 
 Output:
 
-  nonfinite_loopback_ok.vcxproj -> J:\Cpp\fp_facet\fp_facet\Debug\nonfinite_loopback_ok.exe
- 
+nonfinite_loopback_ok.vcxproj -> J:\Cpp\fp_facet\fp_facet\Debug\nonfinite_loopback_ok.exe
 
 */
 
+
Modified: trunk/libs/math/example/nonfinite_signaling_NaN.cpp
==============================================================================
--- trunk/libs/math/example/nonfinite_signaling_NaN.cpp	(original)
+++ trunk/libs/math/example/nonfinite_signaling_NaN.cpp	2011-04-19 13:59:46 EDT (Tue, 19 Apr 2011)
@@ -9,7 +9,7 @@
 \file
 \brief Tests of nonfinite signaling NaN loopback.
 
-\detail  nonfinite signaling NaN 
+\detail  nonfinite signaling NaN
 test outputs using nonfinite facets
 (output and input) and reads back in, and checks if loopback OK.
 
@@ -53,20 +53,20 @@
   { // Try Quiet NaN
     stringstream ss; // Both input and output.
     ss.imbue(default_locale); // Redundant, of course.
-    string infs; 
+    string infs;
     if(numeric_limits<double>::has_quiet_NaN)
     {  // Make sure quiet NaN is specialised for type double.
       double qnan = numeric_limits<double>::quiet_NaN();
       ss << qnan; // Output quiet_NaN.
-      infs = ss.str();  // 
+      infs = ss.str();  //
     }
     else
     { // Need to provide a suitable string for quiet NaN.
-     infs =  "1.#QNAN"; 
+     infs =  "1.#QNAN";
       ss << infs;
     }
- 	  double r;
-	  ss >> r; // Read back in.
+    double r;
+    ss >> r; // Read back in.
 
     cout << "quiet_NaN output was " << infs << endl; // "1.#QNAN"
     cout << "quiet_NaN input was " << r << endl; // "1"
@@ -75,20 +75,20 @@
   { // Try Signaling NaN
     stringstream ss; // Both input and output.
     ss.imbue(default_locale); // Redundant, of course.
-    string infs; 
+    string infs;
     if(numeric_limits<double>::has_signaling_NaN)
     {  // Make sure signaling NaN is specialised for type double.
       double qnan = numeric_limits<double>::signaling_NaN();
       ss << qnan; // Output signaling_NaN.
-      infs = ss.str();  // 
+      infs = ss.str();  //
     }
     else
     { // Need to provide a suitable string for signaling NaN.
-     infs =  "1.#SNAN"; 
+     infs =  "1.#SNAN";
       ss << infs;
     }
- 	  double r;
-	  ss >> r; // Read back in.
+    double r;
+    ss >> r; // Read back in.
 
     cout << "signaling_NaN output was " << infs << endl; // "1.#QNAN" (or "1.#SNAN"?)
     cout << "signaling_NaN input was " << r << endl; // "1"
@@ -99,39 +99,39 @@
   // Note that the legacy flag has no effect on the nonfinite_num_put output facet.
 
   cout << "Use legacy locale." << endl;
-  
+
   { // Try infinity.
     stringstream ss; // Both input and output.
     ss.imbue(legacy_locale);
-    string infs; 
+    string infs;
     if(numeric_limits<double>::has_infinity)
     {  // Make sure infinity is specialised for type double.
       double inf = numeric_limits<double>::infinity();
       ss << inf; // Output infinity.
-      infs = ss.str();  // 
+      infs = ss.str();  //
     }
     else
     { // Need to provide a suitable string for infinity.
-     infs =  "1.#INF"; 
+     infs =  "1.#INF";
       ss << infs;
     }
- 	  double r;
-	  ss >> r; // Read back in.
+    double r;
+    ss >> r; // Read back in.
 
     cout << "infinity output was " << infs << endl; // "1.#INF"
     cout << "infinity input was " << r << endl; // "1.#INF"
   }
 
   { // Try input of "1.#SNAN".
-	  //double inf = numeric_limits<double>::signaling_NaN(); // Assigns "1.#QNAN" on MSVC.
+    //double inf = numeric_limits<double>::signaling_NaN(); // Assigns "1.#QNAN" on MSVC.
     // So must use explicit string "1.#SNAN" instead.
     stringstream ss; // Both input and output.
     ss.imbue(legacy_locale);
     string s = "1.#SNAN";
 
-	  ss << s; // Write out.
-	  double r;
-  
+    ss << s; // Write out.
+    double r;
+
     ss >> r; // Read back in.
 
     cout << "SNAN output was " << s << endl; // "1.#SNAN"
@@ -142,9 +142,9 @@
     stringstream ss; // Both input and output.
     ss.imbue(legacy_locale);
     string s = "1.#IND";
-	  ss << s; // Write out.
-	  double r;
-	  ss >> r; // Read back in.
+    ss << s; // Write out.
+    double r;
+    ss >> r; // Read back in.
 
     cout << "IND output was " << s << endl; // "1.#IND"
     cout << "IND input was " << r << endl;  // "1.#QNAN"
Modified: trunk/libs/math/example/test_nonfinite_loopback.cpp
==============================================================================
--- trunk/libs/math/example/test_nonfinite_loopback.cpp	(original)
+++ trunk/libs/math/example/test_nonfinite_loopback.cpp	2011-04-19 13:59:46 EDT (Tue, 19 Apr 2011)
@@ -38,20 +38,20 @@
   { // Try infinity.
     stringstream ss; // Both input and output.
     ss.imbue(default_locale); // Redundant, of course.
-    string infs; 
+    string infs;
     if(numeric_limits<double>::has_infinity)
     {  // Make sure infinity is specialised for type double.
       double inf = numeric_limits<double>::infinity();
       ss << inf; // Output infinity.
-      infs = ss.str();  // 
+      infs = ss.str();  //
     }
     else
     { // Need to provide a suitable string for infinity.
      infs =  "1.#INF"; // Might suit MSVC?
       ss << infs;
     }
- 	  double r;
-	  ss >> r; // Read back in.
+    double r;
+    ss >> r; // Read back in.
 
     cout << "infinity output was " << infs << endl; // "1.#INF"
     cout << "infinity input was " << r << endl; // "1"
@@ -60,20 +60,20 @@
     { // Try Quiet NaN
     stringstream ss; // Both input and output.
     ss.imbue(default_locale); // Redundant, of course.
-    string infs; 
+    string infs;
     if(numeric_limits<double>::has_quiet_NaN)
     {  // Make sure quiet NaN is specialised for type double.
       double qnan = numeric_limits<double>::quiet_NaN();
       ss << qnan; // Output quiet_NaN.
-      infs = ss.str();  // 
+      infs = ss.str();  //
     }
     else
     { // Need to provide a suitable string for quiet_NAN.
-     infs =  "1.#QNAN"; 
+     infs =  "1.#QNAN";
       ss << infs;
     }
- 	  double r;
-	  ss >> r; // Read back in.
+    double r;
+    ss >> r; // Read back in.
 
     cout << "quiet_NaN output was " << infs << endl; // "1.#QNAN"
     cout << "quiet_NaN input was " << r << endl; // "1#"
@@ -92,6 +92,6 @@
   quiet_NaN output was 1.#QNAN
   quiet_NaN input was 1
 
- 
+
 */