Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71440 - trunk/libs/math/example
From: pbristow_at_[hidden]
Date: 2011-04-23 09:59:12


Author: pbristow
Date: 2011-04-23 09:59:11 EDT (Sat, 23 Apr 2011)
New Revision: 71440
URL: http://svn.boost.org/trac/boost/changeset/71440

Log:
Added check that infinity supported. and ends with newline.
Text files modified:
   trunk/libs/math/example/nonfinite_loopback_ok.cpp | 13 +++++++++++++
   trunk/libs/math/example/nonfinite_num_facet.cpp | 18 +++++++++++++++++-
   trunk/libs/math/example/nonfinite_serialization_archives.cpp | 21 ++++++++++++++++-----
   3 files changed, 46 insertions(+), 6 deletions(-)

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-23 09:59:11 EDT (Sat, 23 Apr 2011)
@@ -18,6 +18,7 @@
 
 #ifdef _MSC_VER
 # pragma warning(disable : 4702)
+# pragma warning(disable : 4127) // conditional expression is constant.
 #endif
 
 #include <boost/math/special_functions/nonfinite_num_facets.hpp>
@@ -40,6 +41,18 @@
 
 int main()
 {
+
+ if((std::numeric_limits<double>::has_infinity == false) || (std::numeric_limits<double>::infinity() == 0))
+ {
+ std::cout << "Infinity not supported on this platform." << std::endl;
+ return 0;
+ }
+
+ if((std::numeric_limits<double>::has_quiet_NaN == false) || (std::numeric_limits<double>::quiet_NaN() == 0))
+ {
+ std::cout << "NaN not supported on this platform." << std::endl;
+ return 0;
+ }
   //locale old_locale; // Current global locale.
   // Create tmp_locale and store the output nonfinite_num_put facet in it.
   //locale tmp_locale(old_locale, new nonfinite_num_put<char>);

Modified: trunk/libs/math/example/nonfinite_num_facet.cpp
==============================================================================
--- trunk/libs/math/example/nonfinite_num_facet.cpp (original)
+++ trunk/libs/math/example/nonfinite_num_facet.cpp 2011-04-23 09:59:11 EDT (Sat, 23 Apr 2011)
@@ -33,6 +33,10 @@
   
 */
 
+#ifdef _MSC_VER
+# pragma warning(disable : 4127) // conditional expression is constant.
+#endif
+
 #include <iostream>
 #include <iomanip>
 using std::cout;
@@ -170,6 +174,18 @@
 {
   std::cout << "nonfinite_num_facet simple example." << std::endl;
 
+ if((std::numeric_limits<double>::has_infinity == false) || (std::numeric_limits<double>::infinity() == 0))
+ {
+ std::cout << "Infinity not supported on this platform." << std::endl;
+ return 0;
+ }
+
+ if((std::numeric_limits<double>::has_quiet_NaN == false) || (std::numeric_limits<double>::quiet_NaN() == 0))
+ {
+ std::cout << "NaN not supported on this platform." << std::endl;
+ return 0;
+ }
+
 #ifdef BOOST_NO_NUMERIC_LIMITS_LOWEST
   cout << "BOOST_NO_NUMERIC_LIMITS_LOWEST is defined, so no max_digits10 available either:"
      "\n we'll have to calculate our own version." << endl;
@@ -272,4 +288,4 @@
   Input done.
   End nonfinite_num_facet.cpp
 
-*/
\ No newline at end of file
+*/

Modified: trunk/libs/math/example/nonfinite_serialization_archives.cpp
==============================================================================
--- trunk/libs/math/example/nonfinite_serialization_archives.cpp (original)
+++ trunk/libs/math/example/nonfinite_serialization_archives.cpp 2011-04-23 09:59:11 EDT (Sat, 23 Apr 2011)
@@ -28,10 +28,12 @@
 */
 
 
-#ifdef MSC_VER
+#ifdef _MSC_VER
 # pragma warning (disable :4224)
+# pragma warning(disable : 4127) // conditional expression is constant.
 #endif
 
+
 #include <boost/archive/text_oarchive.hpp>
 using boost::archive::text_oarchive;
 #include <boost/archive/codecvt_null.hpp>
@@ -95,6 +97,18 @@
 int main()
 {
 
+ if((std::numeric_limits<double>::has_infinity == false) || (std::numeric_limits<double>::infinity() == 0))
+ {
+ std::cout << "Infinity not supported on this platform." << std::endl;
+ return 0;
+ }
+
+ if((std::numeric_limits<double>::has_quiet_NaN == false) || (std::numeric_limits<double>::quiet_NaN() == 0))
+ {
+ std::cout << "NaN not supported on this platform." << std::endl;
+ return 0;
+ }
+
   locale default_locale(locale::classic(), new boost::archive::codecvt_null<char>);
   // codecvt_null so the archive constructor will not imbue the stream with a new locale.
 
@@ -120,7 +134,4 @@
 Serialization archives do not check the stream state.
 
 
-u
-
-
-*/
\ No newline at end of file
+*/


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk