Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85347 - in trunk/boost/multiprecision: . concepts
From: john_at_[hidden]
Date: 2013-08-14 11:31:48


Author: johnmaddock
Date: 2013-08-14 11:31:48 EDT (Wed, 14 Aug 2013)
New Revision: 85347
URL: http://svn.boost.org/trac/boost/changeset/85347

Log:
Fix std::numeric_limits<>::round_error().

Text files modified:
   trunk/boost/multiprecision/concepts/mp_number_archetypes.hpp | 2 +-
   trunk/boost/multiprecision/cpp_dec_float.hpp | 2 +-
   trunk/boost/multiprecision/float128.hpp | 4 ++--
   trunk/boost/multiprecision/gmp.hpp | 5 ++---
   trunk/boost/multiprecision/mpfi.hpp | 2 +-
   trunk/boost/multiprecision/mpfr.hpp | 2 +-
   6 files changed, 8 insertions(+), 9 deletions(-)

Modified: trunk/boost/multiprecision/concepts/mp_number_archetypes.hpp
==============================================================================
--- trunk/boost/multiprecision/concepts/mp_number_archetypes.hpp Wed Aug 14 11:31:46 2013 (r85346)
+++ trunk/boost/multiprecision/concepts/mp_number_archetypes.hpp 2013-08-14 11:31:48 EDT (Wed, 14 Aug 2013) (r85347)
@@ -215,7 +215,7 @@
    static number_type (max)() BOOST_NOEXCEPT { return (base_type::max)(); }
    static number_type lowest() BOOST_NOEXCEPT { return -(max)(); }
    static number_type epsilon() BOOST_NOEXCEPT { return base_type::epsilon(); }
- static number_type round_error() BOOST_NOEXCEPT { return epsilon() / 2; }
+ static number_type round_error() BOOST_NOEXCEPT { return base_type::round_error(); }
    static number_type infinity() BOOST_NOEXCEPT { return base_type::infinity(); }
    static number_type quiet_NaN() BOOST_NOEXCEPT { return base_type::quiet_NaN(); }
    static number_type signaling_NaN() BOOST_NOEXCEPT { return base_type::signaling_NaN(); }

Modified: trunk/boost/multiprecision/cpp_dec_float.hpp
==============================================================================
--- trunk/boost/multiprecision/cpp_dec_float.hpp Wed Aug 14 11:31:46 2013 (r85346)
+++ trunk/boost/multiprecision/cpp_dec_float.hpp 2013-08-14 11:31:48 EDT (Wed, 14 Aug 2013) (r85347)
@@ -2960,7 +2960,7 @@
       BOOST_STATIC_CONSTEXPR ExponentType max_exponent = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_max_exp; // Type differs from int.
       BOOST_STATIC_CONSTEXPR ExponentType max_exponent10 = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_max_exp10; // Type differs from int.
       BOOST_STATIC_CONSTEXPR int radix = boost::multiprecision::cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_radix;
- BOOST_STATIC_CONSTEXPR std::float_round_style round_style = std::round_to_nearest;
+ BOOST_STATIC_CONSTEXPR std::float_round_style round_style = std::round_indeterminate;
       BOOST_STATIC_CONSTEXPR bool has_infinity = true;
       BOOST_STATIC_CONSTEXPR bool has_quiet_NaN = true;
       BOOST_STATIC_CONSTEXPR bool has_signaling_NaN = false;

Modified: trunk/boost/multiprecision/float128.hpp
==============================================================================
--- trunk/boost/multiprecision/float128.hpp Wed Aug 14 11:31:46 2013 (r85346)
+++ trunk/boost/multiprecision/float128.hpp 2013-08-14 11:31:48 EDT (Wed, 14 Aug 2013) (r85347)
@@ -521,7 +521,7 @@
    BOOST_STATIC_CONSTEXPR bool is_exact = false;
    BOOST_STATIC_CONSTEXPR int radix = 2;
    static number_type epsilon() { return 1.92592994438723585305597794258492732e-34Q; }
- static number_type round_error() { return 0; }
+ static number_type round_error() { return 0.5; }
    BOOST_STATIC_CONSTEXPR int min_exponent = -16381;
    BOOST_STATIC_CONSTEXPR int min_exponent10 = min_exponent * 301L / 1000L;
    BOOST_STATIC_CONSTEXPR int max_exponent = 16384;
@@ -540,7 +540,7 @@
    BOOST_STATIC_CONSTEXPR bool is_modulo = false;
    BOOST_STATIC_CONSTEXPR bool traps = false;
    BOOST_STATIC_CONSTEXPR bool tinyness_before = false;
- BOOST_STATIC_CONSTEXPR float_round_style round_style = round_toward_zero;
+ BOOST_STATIC_CONSTEXPR float_round_style round_style = round_to_nearest;
 };
 
 } // namespace std

Modified: trunk/boost/multiprecision/gmp.hpp
==============================================================================
--- trunk/boost/multiprecision/gmp.hpp Wed Aug 14 11:31:46 2013 (r85346)
+++ trunk/boost/multiprecision/gmp.hpp 2013-08-14 11:31:48 EDT (Wed, 14 Aug 2013) (r85347)
@@ -2287,7 +2287,6 @@
       {
          value.first = true;
          value.second = 1;
- mpf_div_2exp(value.second.backend().data(), value.second.backend().data(), digits);
       }
       return value.second;
    }
@@ -2309,7 +2308,7 @@
    BOOST_STATIC_CONSTEXPR bool is_modulo = false;
    BOOST_STATIC_CONSTEXPR bool traps = true;
    BOOST_STATIC_CONSTEXPR bool tinyness_before = false;
- BOOST_STATIC_CONSTEXPR float_round_style round_style = round_to_nearest;
+ BOOST_STATIC_CONSTEXPR float_round_style round_style = round_indeterminate;
 
 private:
    struct data_initializer
@@ -2365,7 +2364,7 @@
    BOOST_STATIC_CONSTEXPR bool is_modulo = false;
    BOOST_STATIC_CONSTEXPR bool traps = false;
    BOOST_STATIC_CONSTEXPR bool tinyness_before = false;
- BOOST_STATIC_CONSTEXPR float_round_style round_style = round_toward_zero;
+ BOOST_STATIC_CONSTEXPR float_round_style round_style = round_indeterminate;
 };
 
 #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION

Modified: trunk/boost/multiprecision/mpfi.hpp
==============================================================================
--- trunk/boost/multiprecision/mpfi.hpp Wed Aug 14 11:31:46 2013 (r85346)
+++ trunk/boost/multiprecision/mpfi.hpp 2013-08-14 11:31:48 EDT (Wed, 14 Aug 2013) (r85347)
@@ -1291,7 +1291,7 @@
       {
          value.first = true;
          value.second = 1;
- mpfi_div_2exp(value.second.backend().data(), value.second.backend().data(), digits);
+ mpfi_div_2exp(value.second.backend().data(), value.second.backend().data(), 1);
       }
       return value.second;
    }

Modified: trunk/boost/multiprecision/mpfr.hpp
==============================================================================
--- trunk/boost/multiprecision/mpfr.hpp Wed Aug 14 11:31:46 2013 (r85346)
+++ trunk/boost/multiprecision/mpfr.hpp 2013-08-14 11:31:48 EDT (Wed, 14 Aug 2013) (r85347)
@@ -1624,7 +1624,7 @@
       {
          value.first = true;
          value.second = 1;
- mpfr_div_2exp(value.second.backend().data(), value.second.backend().data(), digits, GMP_RNDN);
+ mpfr_div_2exp(value.second.backend().data(), value.second.backend().data(), 1, GMP_RNDN);
       }
       return value.second;
    }


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