Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r73471 - in sandbox/e_float: boost/e_float libs/e_float/src/e_float/efx libs/e_float/test/real/cases
From: e_float_at_[hidden]
Date: 2011-08-01 06:37:24


Author: christopher_kormanyos
Date: 2011-08-01 06:37:24 EDT (Mon, 01 Aug 2011)
New Revision: 73471
URL: http://svn.boost.org/trac/boost/changeset/73471

Log:
- Improved standards-conformance of limits.
- Commented some test cases.
Text files modified:
   sandbox/e_float/boost/e_float/e_float_limits.hpp | 63 ++++++++++++++++++++-------------------
   sandbox/e_float/libs/e_float/src/e_float/efx/e_float_efx.cpp | 2 -
   sandbox/e_float/libs/e_float/test/real/cases/test_case_0000x_overflow_underflow.cpp | 3 +
   sandbox/e_float/libs/e_float/test/real/cases/test_case_0000y_write_to_ostream.cpp | 6 +++
   4 files changed, 40 insertions(+), 34 deletions(-)

Modified: sandbox/e_float/boost/e_float/e_float_limits.hpp
==============================================================================
--- sandbox/e_float/boost/e_float/e_float_limits.hpp (original)
+++ sandbox/e_float/boost/e_float/e_float_limits.hpp 2011-08-01 06:37:24 EDT (Mon, 01 Aug 2011)
@@ -30,37 +30,40 @@
   {
     template <> class numeric_limits<e_float>
     {
- public: // Implement the "usual" public members for floating point types.
- static const bool is_specialized = true;
- static const bool is_signed = true;
- static const bool is_integer = false;
- static const bool is_exact = false;
- static const bool is_bounded = true;
- static const bool is_modulo = false;
- static const bool is_iec559 = false;
- static const INT32 digits10 = e_float::ef_digits10;
- static const INT32 max_digits10 = e_float::ef_digits10 + 1;
- static const INT32 digits = e_float::ef_digits;
- static const INT64 max_exponent = e_float::ef_max_exp;
- static const INT64 min_exponent = e_float::ef_min_exp;
- static const INT64 max_exponent10 = e_float::ef_max_exp10;
- static const INT64 min_exponent10 = e_float::ef_min_exp10;
- static const INT32 radix = e_float::ef_radix;
- static const int round_style = std::round_to_nearest;
- static const bool has_infinity = true;
- static const bool has_quiet_NaN = true;
- static const bool has_signaling_NaN = false;
- static const int has_denorm = std::denorm_absent;
- static const bool has_denorm_loss = false;
- static const bool traps = false;
- static const bool tinyness_before = false;
+ public:
+ static const bool is_specialized = true;
+ static const bool is_signed = true;
+ static const bool is_integer = false;
+ static const bool is_exact = false;
+ static const bool is_bounded = true;
+ static const bool is_modulo = false;
+ static const bool is_iec559 = false;
+ static const INT32 digits = e_float::ef_digits; // Differs from int.
+ static const INT32 digits10 = e_float::ef_digits10; // Differs from int.
+ static const INT32 max_digits10 = e_float::ef_digits10 + 1; // Differs from int.
+ static const INT64 min_exponent = e_float::ef_min_exp; // Differs from int.
+ static const INT64 min_exponent10 = e_float::ef_min_exp10; // Differs from int.
+ static const INT64 max_exponent = e_float::ef_max_exp; // Differs from int.
+ static const INT64 max_exponent10 = e_float::ef_max_exp10; // Differs from int.
+ static const int radix = e_float::ef_radix;
+ static const std::float_round_style round_style = std::round_to_nearest;
+ static const bool has_infinity = true;
+ static const bool has_quiet_NaN = true;
+ static const bool has_signaling_NaN = false;
+ static const std::float_denorm_style has_denorm = std::denorm_absent;
+ static const bool has_denorm_loss = false;
+ static const bool traps = false;
+ static const bool tinyness_before = false;
 
- static const e_float& (min) (void) throw() { return ef::value_min(); }
- static const e_float& (max) (void) throw() { return ef::value_max(); }
- static const e_float& epsilon (void) throw() { return ef::value_eps(); }
- static const e_float& round_error(void) throw() { return ef::half(); }
- static const e_float& infinity (void) throw() { return ef::value_inf(); }
- static const e_float& quiet_NaN (void) throw() { return ef::value_nan(); }
+ static const e_float& (min) (void) throw() { return ef::value_min(); }
+ static const e_float& (max) (void) throw() { return ef::value_max(); }
+ static const e_float& lowest (void) throw() { return ef::zero(); }
+ static const e_float& epsilon (void) throw() { return ef::value_eps(); }
+ static const e_float& round_error (void) throw() { return ef::half(); }
+ static const e_float& infinity (void) throw() { return ef::value_inf(); }
+ static const e_float& quiet_NaN (void) throw() { return ef::value_nan(); }
+ static const e_float& signaling_NaN(void) throw() { return ef::zero(); }
+ static const e_float& denorm_min (void) throw() { return ef::zero(); }
     };
   }
 

Modified: sandbox/e_float/libs/e_float/src/e_float/efx/e_float_efx.cpp
==============================================================================
--- sandbox/e_float/libs/e_float/src/e_float/efx/e_float_efx.cpp (original)
+++ sandbox/e_float/libs/e_float/src/e_float/efx/e_float_efx.cpp 2011-08-01 06:37:24 EDT (Mon, 01 Aug 2011)
@@ -1396,7 +1396,6 @@
   return x;
 }
 
-// NOCOVER_BLK_BEG
 const efx::e_float& efx::e_float::my_value_nan(void) const
 {
   static e_float val = ef::zero();
@@ -1407,7 +1406,6 @@
 
   return qnan;
 }
-// NOCOVER_BLK_END
 
 const efx::e_float& efx::e_float::my_value_inf(void) const
 {

Modified: sandbox/e_float/libs/e_float/test/real/cases/test_case_0000x_overflow_underflow.cpp
==============================================================================
--- sandbox/e_float/libs/e_float/test/real/cases/test_case_0000x_overflow_underflow.cpp (original)
+++ sandbox/e_float/libs/e_float/test/real/cases/test_case_0000x_overflow_underflow.cpp 2011-08-01 06:37:24 EDT (Mon, 01 Aug 2011)
@@ -27,7 +27,8 @@
 
       virtual const std::vector<e_float>& control_data(void) const
       {
- static const std::vector<e_float> dummy; return dummy;
+ static const std::vector<e_float> dummy(1u, ef::one());
+ return dummy;
       }
 
     public:

Modified: sandbox/e_float/libs/e_float/test/real/cases/test_case_0000y_write_to_ostream.cpp
==============================================================================
--- sandbox/e_float/libs/e_float/test/real/cases/test_case_0000y_write_to_ostream.cpp (original)
+++ sandbox/e_float/libs/e_float/test/real/cases/test_case_0000y_write_to_ostream.cpp 2011-08-01 06:37:24 EDT (Mon, 01 Aug 2011)
@@ -82,7 +82,8 @@
 
       virtual const std::vector<e_float>& control_data(void) const
       {
- static const std::vector<e_float> dummy; return dummy;
+ static const std::vector<e_float> dummy(1u, ef::one());
+ return dummy;
       }
 
     public:
@@ -202,6 +203,7 @@
         ss.clear();
         ss.str("");
 
+ // Note negative sign.
         ss << std::fixed << std::showpos << std::showpoint << std::setprecision(19) << -ef::pi() * e_float("1e10");
         str = ss.str();
         data.push_back(e_float(str));
@@ -279,6 +281,7 @@
         ss.clear();
         ss.str("");
 
+ // Note negative sign.
         ss << std::scientific << std::showpos << std::showpoint << std::setprecision(20) << -ef::pi() * e_float("1e-43");
         str = ss.str();
         data.push_back(e_float(str));
@@ -286,6 +289,7 @@
         ss.clear();
         ss.str("");
 
+ // Note uppercase.
         ss << std::scientific << std::showpos << std::showpoint << std::uppercase << std::setprecision(20) << ef::pi();
         str = ss.str();
         data.push_back(e_float(str));


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